Use the MONTHS_BETWEEN function : MONTHS_BETWEEN « Date Timestamp Functions « Oracle PL/SQL Tutorial






To find the time difference between two dates, use the MONTHS_BETWEEN function.

The MONTHS_BETWEEN function returns fractional months.

The general format of the function is: MONTHS_BETWEEN(date1, date2)

where the result will be date1 - date2.

SQL>
SQL> SELECT MONTHS_BETWEEN(TO_DATE('22SEP2006','ddMONyyyy'), TO_DATE('13OCT2001','ddMONyyyy')) "Months difference"
  2  FROM dual;

Months difference
-----------------
       59.2903226

SQL>








13.10.MONTHS_BETWEEN
13.10.1.MONTHS_BETWEEN(x, y): get the number of months between x and y.
13.10.2.Returned result is a negative number of months
13.10.3.Use the MONTHS_BETWEEN function
13.10.4.SELECT MONTHS_BETWEEN('15-JAN-2005', '25-MAY-2005')
13.10.5.months_between current time and birthday
13.10.6.Months between birthday and now