Created
May 11, 2012 22:20
-
-
Save myleftboot/2662763 to your computer and use it in GitHub Desktop.
SQL code in need of a decode. Try to do as much computation within the sql as is reasonably possible.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FUNCTION get_printed_status | |
RETURN varchar2 IS | |
v_order status orders.printed%TYPE; | |
v_status varchar2(30); | |
BEGIN | |
SELECT printed | |
INTO v_order_status | |
FROM orders | |
WHERE order_no = p_order_no; | |
IF v_order_status = 0 OR v_order_status IS NULL THEN | |
v_status = 'NOT PRINTED'; | |
ELSIF v_order_status = 2 THEN | |
v_status = 'ON HOLD'; | |
ELSIF v_order_status = 1 THEN | |
v_status = 'PRINTED'; | |
ELSE | |
v_status = 'UNKNOWN'; | |
END IF; | |
RETURN v_order_status; | |
END get_printed_status; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment