Calculating Date of Birth

I have a table with Register_ Year, Date of Birth.  I need to calculate Age using 01-10-Register_ Year and Date of Birth.  Can anyone help with this in Oracle
Coco BeansDesignerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) Commented:
I would use:  MONTHS_BETWEEN(to_date('01-20-'||register_year,'MM-DD-YYYY'),DOB)/12

It might not be exact but you get the idea.
Mark GeerlingsDatabase AdministratorCommented:
What are the data types of your two columns: Register_ Year and Date of Birth?

If "Date of Birth" is already a "date" column, it seems that you would not need to calculate a date of birth.  But, if that column is actually a VARCHAR2, CHAR or NUMBER column that contains a month and day, then doing this calculation becomes more complex.  The biggest challenge then is likely to be "dirty data", that is: values that don't fit a consistent pattern, or are incomplete, or have invalid values, like "Feb. 30" or "13" for a numeric month.
If "Date of Birth" is already a "date" column, it seems that you would not need to calculate a date of birth.

the title was wrong. the right question is  

How to calculate the age from 'register year' and 'date of birth'. 

Open in new window

as told in the body of the question.

my problem is that i don't know what
1-10 register_year
 is? is it a 4-digit year (string) as assumed by slightwv? or is it the indices 1,2,..10 pointing to a table of register years?

Coco, can you give better information?

Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Coco BeansDesignerAuthor Commented:
Calculated like this..

you better should try straight-forward


Open in new window

and avoid those many unneeded conversions.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
slightwv (䄆 Netminder) Commented:
>>you better should try straight-forward

That would be great if YEAR was an Oracle function:
extract(year from birth_date)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.