Find employees aged 16 and younger in ORACLE SQL

Hi

im trying to write a query which finds any staff which are 16 or younger using  a CTE.

BIRTH_DATE <= sysdate - 16*12

This isnt working though.

Is my syntax wrong?

Thanks
Richiep86Asked:
Who is Participating?

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

x
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.

Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
You need to check for greater or equal, not less or equal. And dates are represented in fractions of a day, not months:
   BIRTH_DATE >= sysdate - 16*365

However, it is much better to use the date specific functions or intervals:
   BIRTH_DATE >= sysdate - interval '16' years
or
   BIRTH_DATE >= add_months(sysdate, -16*12)
0

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
Richiep86Author Commented:
Perfect!
0
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
Oracle Database

From novice to tech pro — start learning today.