CREATE OR REPLACE FUNCTION nianyue(CARD VARCHAR2) RETURN VARCHAR2 IS NY DATE; BEGIN SELECT to_date(to_char(substr(REPLACE(CARD, ' ', ''),7,8)),'YYYYMMDD') INTO ny FROM dual; RETURN ny; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('异常:'); DBMS_OUTPUT.PUT_LINE(SQLCODE||sqlerrm); RETURN ''; END; --调用函数 SELECT nianyue('610528 198911202426') FROM dual
标签:RETURN,身份证,nianyue,VARCHAR2,dual,Oracle,出生年月,LINE,SELECT From: https://www.cnblogs.com/erguai/p/16853280.html