Oracle Age calculation from Date of birth and Today

前端 未结 13 1385
Happy的楠姐
Happy的楠姐 2020-11-27 15:31

I want to calculate the current Age from Date of Birth in my Oracle function.

What I am using is (Today-Dob)/30/12, but this is not accurate as some mon

13条回答
  •  有刺的猬
    2020-11-27 15:47

    You can try below method,

    SELECT EXTRACT(YEAR FROM APP_SUBMITTED_DATE)-EXTRACT(YEAR FROM BIRTH_DATE) FROM SOME_TABLE;

    It will compare years and give age accordingly.
    You can also use SYSDATE instead of APP_SUBMITTED_DATE.

    Regards.

提交回复
热议问题