Search notes:

Oracle: MONTHS_BETWEEN

months_between(dt_1, dt_2) calculates the (fractional) number of months between the two dates dt_1 and dt_2. The result is positive, if dt_2 is earlier than dt_1.
The following statement returns 42:
select
   months_between(
      add_months(sysdate, 42), -- The first parameter denotes a point in time after
                 sysdate       -- the point in time specified with the second parameter:
   )                           -- the result is positive.
from
   dual;

See also

add_months
In order to get whole numbers, the result might be passed to round(), ceil() or floor().
Other date related SQL functions

Index