how to calculate age in oracle
685758Sep 9 2011 — edited Sep 9 2011Hi,
T was trying do calculate age as on todays date in ORACLE but after a lot of brain storming i didn't get it.
Kindly tell me how to calculate age as in years month days.
For ex.. My DOB- 02-feb-1984 so my age should get as 27 Years 2 months 8 days
How to do it.
I tried this
select
TRUNC( months_between( sysdate, TO_DATE('02-02-1984','DD-MM-YYYY') )/12 ) Year,
TRUNC( mod(months_between( sysdate, TO_DATE('02-02-1984','DD-MM-YYYY') ),12) ) Month,
mod(months_between( sysdate, TO_DATE('02-02-1984','DD-MM-YYYY') ),12) /30 Days
from dual
but days are not calculating correctly...
RGds,
PC