- 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 !