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));date

相關文章
相關標籤/搜索