CREATE OR REPLACE FUNCTION Fun_getbirthDayfromIdntity (Idntity IN VARCHAR2) --定义入参
/*根据身份证号获取出生日期*/
RETURN DATE
IS
birthday DATE;--定义返回值
bx_exception EXCEPTION;--定义异常变量
BEGIN
SELECT to_date(substr(Idntity,7,8),'yyyy-MM-dd') INTO birthday FROM dual; --赋值
RAISE bx_exception;--捕获异常
EXCEPTION
WHEN others THEN NULL;--
RETURN (birthday);--返回
END Fun_getbirthDayfromIdntity;--结束