Return to Snippet

Revision: 71101
at January 20, 2017 06:09 by bbrumm


Initial Code
--MONTHS_BETWEEN

SELECT MONTHS_BETWEEN(
  TO_DATE('01/06/2015', 'dd/mm/yyyy'),
  TO_DATE('07/02/2015', 'dd/mm/yyyy'))
AS MB_TEST FROM dual;


SELECT MONTHS_BETWEEN(
  TO_DATE('14/03/2015', 'dd/mm/yyyy'),
  TO_DATE('20/09/2015', 'dd/mm/yyyy'))
AS MB_TEST FROM dual;

SELECT MONTHS_BETWEEN(
  TO_DATE('10/12/2004', 'dd/mm/yyyy'),
  TO_DATE('02/05/1981', 'dd/mm/yyyy'))
AS MB_TEST FROM dual;



SELECT MONTHS_BETWEEN(
  TO_DATE('04/08/2015', 'dd/mm/yyyy'),
  TO_DATE('04/04/2015', 'dd/mm/yyyy'))
AS MB_TEST FROM dual;


SELECT MONTHS_BETWEEN(
  TO_DATE('11/04/2015', 'dd/mm/yyyy'),
  TO_DATE('11/04/2015', 'dd/mm/yyyy'))
AS MB_TEST FROM dual;


SELECT MONTHS_BETWEEN(
  TO_DATE('31/01/2015', 'dd/mm/yyyy'),
  TO_DATE('30/04/2015', 'dd/mm/yyyy'))
AS MB_TEST FROM dual;

Initial URL
http://www.databasestar.com/oracle-months_between/

Initial Description
A few examples of the MONTHS_BETWEEN function.

Initial Title
Oracle MONTHS_BETWEEN Function

Initial Tags
sql, Oracle

Initial Language
SQL