方法一:
SELECT TRUNC(months_between(sysdate,birth)/12) AS age from mytable
方法二:
select TRUNC((to_char(sysdate,'yyyyMMdd') - to_char(birth,'yyyyMMdd')) / 10000) as age from mytable
注:sysdate 为系统日期时间,birth 为表中出生日期字段
作者:itmyhome
原文链接:https://www.f2er.com/oracle/212697.html