Created
May 11, 2012 22:23
-
-
Save myleftboot/2662790 to your computer and use it in GitHub Desktop.
Move your logic into the sql statement, clean up your code....
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 decode(printed, null, 'NOT PRINTED' | |
, 0, 'NOT PRINTED' | |
, 1, 'PRINTED' | |
, 2, 'ON HOLD' | |
, 'UNKNOWN') | |
INTO v_status | |
FROM orders | |
WHERE order_no = p_order_no; | |
RETURN v_status; | |
END get_printed_status; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment