SELECT
TRUNC(MONTHS_BETWEEN(SYSDATE,DOB)/12) YEAR,
TRUNC(MOD(MONTHS_BETWEEN(SYSDATE,DOB),12)) MONTH,
TRUNC(SYSDATE-ADD_MONTHS(DOB,TRUNC(MONTHS_BETWEEN(SYSDATE,DOB)/12)*12+TRUNC(MOD(MONTHS_BETWEEN(SYSDATE,DOB),12)))) DAY
FROM (SELECT TO_DATE('01071981','DDMMYYYY') DOB FROM DUAL);
TRUNC(MONTHS_BETWEEN(SYSDATE,DOB)/12) YEAR,
TRUNC(MOD(MONTHS_BETWEEN(SYSDATE,DOB),12)) MONTH,
TRUNC(SYSDATE-ADD_MONTHS(DOB,TRUNC(MONTHS_BETWEEN(SYSDATE,DOB)/12)*12+TRUNC(MOD(MONTHS_BETWEEN(SYSDATE,DOB),12)))) DAY
FROM (SELECT TO_DATE('01071981','DDMMYYYY') DOB FROM DUAL);
No comments:
Post a Comment