Be aware of this function, it may have unexpected results :
SELECT add_months(TO_DATE('27-JAN-2007'), 1) FROM dual;This queries returns :
SELECT add_months(TO_DATE('28-JAN-2007'), 1) FROM dual;
SELECT add_months(TO_DATE('29-JAN-2007'), 1) FROM dual;
SELECT add_months(TO_DATE('30-JAN-2007'), 1) FROM dual;
SELECT add_months(TO_DATE('31-JAN-2007'), 1) FROM dual;
SELECT add_months(TO_DATE('01-FEV-2007'), 1) FROM dual;
27-02-2007If you need to add a specific number of days, consider to use :
28-02-2007
28-02-2007
28-02-2007
28-02-2007
01-03-2007
SELECT TO_DATE('01-FEV-2007') + 30 FROM dual;
No comments:
Post a Comment