CREATE OR REPLACE FUNCTION XINGBIE(CARD VARCHAR2) RETURN VARCHAR2 IS XB VARCHAR2(3); BEGIN SELECT DECODE(MOD(TO_NUMBER(SUBSTR(REPLACE(CARD, ' ', ''), 17, 1)), 2), 0, '女', '男') INTO XB FROM DUAL; RETURN XB; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('异常:'); DBMS_OUTPUT.PUT_LINE(SQLCODE || SQLERRM); RETURN ''; END; --调用函数 SELECT xingbie('610528200211202416') FROM dual
标签:RETURN,XB,REPLACE,VARCHAR2,身份证,Oracle,LINE,性别,SELECT From: https://www.cnblogs.com/erguai/p/16853284.html