以下三种方法均可实现周岁年龄的计算:
--算法一: SELECT TRUNC(months_between(sysdate, csrq)/12) AS "Age" FROM wrxxb; --算法二: SELECT trunc(to_number(to_char(sysdate,'yyyymmdd'))/10000 - to_number(to_char(to_date('1982-8-28','yyyy-mm-dd'),'yyyymmdd'))/10000) FROM dual; --算法三: SELECT to_char(sysdate,'yyyy')-to_char(csrq,'yyyy')+ decode(sign(to_char(sysdate,'mmdd')-to_char(csrq,'mmdd')),-1,-1,0,0,1,0) FROM wrxxb