Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

pl sql age calculation edge cases

2886750Aug 15 2015 — edited Aug 15 2015

Hi All,

I have seen some solutions from the past for age calculation. But i have one problem.

I need to check whether a person is less than 19 years.

The sql i used was

select months_between(sysdate, to_date(birth_date, 'YYYYMMDD'))/12

I'm using the date where sysdate is 20150412 and birthDate = 19960413

the answer we get is 19.3407 years though this person is not 19 years yet.

How do i get the accurate age?

Thanks in advance

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 12 2015
Added on Aug 15 2015
5 comments
887 views