Time - Age Report

2 - Example

CREATE TABLE t ( x DATE );
Table created.
INSERT INTO t VALUES ( to_date( '15-mar-1965', 'dd-mon-yyyy' ) );
1 row created.
SELECT ( systimestamp - CAST( x AS TIMESTAMP ) ) YEAR TO MONTH FROM t;
(SYSTIMESTAMP-CAST(XASTIMESTAMP))YEARTOMONTH
---------------------------------------------------------------------------
+44-01
SELECT 
        trunc(months_between(sysdate,x)/12) years,
        months_between(sysdate,x)-12*trunc(months_between(sysdate,x)/12) months
FROM t;
     YEARS     MONTHS
---------- ----------
        44 1.05426971

3 - Reference

data/type/time/age_report.txt ยท Last modified: 2017/09/13 16:11 by gerardnico