Return to Snippet

Revision: 71253
at January 27, 2017 06:13 by bbrumm


Initial Code
SELECT SYSDATE,
ADD_MONTHS(SYSDATE, 1) as ADD_MONTH_RESULT
FROM dual;

SELECT SYSDATE,
ADD_MONTHS(SYSDATE, 6) as ADD_MONTH_RESULT
FROM dual;


SELECT SYSDATE,
ADD_MONTHS(SYSDATE, 41) as ADD_MONTH_RESULT
FROM dual;


SELECT SYSDATE, ADD_MONTHS(SYSDATE, -6) as ADD_MONTH_RESULT
FROM dual;


SELECT SYSDATE, ADD_MONTHS(SYSDATE, '5') as ADD_MONTH_RESULT
FROM dual;


SELECT SYSDATE, ADD_MONTHS(SYSDATE, 'Six') as ADD_MONTH_RESULT
FROM dual;

SELECT TO_DATE('08-JUL-2015') as INPUT_DATE,
ADD_MONTHS(TO_DATE('08-JUL-2015'), 1) as ADD_MONTH_RESULT
FROM dual;


SELECT SYSDATE, 
ADD_MONTHS(SYSDATE, 2.3) as ADD_MONTH_RESULT_LOW,
ADD_MONTHS(SYSDATE, 2.9) as ADD_MONTH_RESULT_HIGH
FROM dual;


SELECT SYSDATE, ADD_MONTHS(SYSDATE, 12) as ADD_MONTH_RESULT
FROM dual;


SELECT SYSDATE,
TRUNC(ADD_MONTHS(LAST_DAY(SYSDATE)+1,-1)) as FIRST_DAY
FROM dual;

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

Initial Description
A few examples of the ADD_MONTHS function

Initial Title
Oracle ADD_MONTHS Function

Initial Tags
sql, Oracle

Initial Language
SQL