• Caluclating age from date of birth is used in almost all the applications.
  • In Order to calculate this we use trunc() function in Oracle.
  • The trunc function returns a date truncated to a specific unit of measure.
  • To use the present date use the function sysdate.
  • Subtract the system current date and date of birth.
  • Divide the result by 365.25.
  • Give the entire result inside the trunc function.
select name,trunc( (sysdate - dob) / 365.25) ) from tablename;

 

Thank u for reading this Β Article hope it was useful !

 

-Regards

 

ScriptSnippets

 

About Sathesh Bm

Sathesh Bm has written 26 post in this website.

Engineer, Web Lover, Thinker, Blogger

Related Posts Plugin for WordPress, Blogger...