Hi.
The solution provided is wrong (or at least not completely right).
You should use ADD_MONTH() instead, because:
SELECT DATE '2012-02-29' - INTERVAL '1' YEAR;
*** Failure 2665 Invalid date.
Statement# 1, Info =0
*** Total elapsed time was 1 second.
but
SELECT ADD_MONTHS(DATE '2012-02-29', - 12);
*** Query completed. One row found. One column returned.
*** Total elapsed time was 1 second.
ADD_MONTHS(2012-02-29, -12)
---------------------------
2011-02-28
HTH.
Cheers.
Carlos.
↧