oracle 年龄计算 岁 月 天

select trunc(months/12) || '岁' || trunc(mod(months, 12)) || '月' ||
       trunc(sysdate - add_months(birth, trunc(months))) || '天' age
  from (select months_between(sysdate, birth) months, birth
          from (select date '2016-1-1' birth from dual));

posted @ 2017-06-06 11:10  向阳的影子  阅读(1594)  评论(0编辑  收藏  举报