/ Published in: SQL
A few examples of the ADD_MONTHS function
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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;
URL: http://www.databasestar.com/oracle-add_months