DB2 Scalar functions - ADD_MONTHS
The ADD_MONTHS function returns a datetime value that represents expression plus a specified number of months.
The schema is SYSIBM.
The result of the function has the same data type as expression, unless expression is a string, in which case the result data type is DATE. The result can be null; if any argument is null, the result is the null value.
If expression is the last day of the month or if the resulting month has fewer days than the day component of expression, the result is the last day of the resulting month. Otherwise, the result has the same day component as expression. Any hours, minutes, seconds or fractional seconds information included in expression is not changed by the function.
SET :ADD_MONTH = ADD_MONTHS(LAST_DAY(CURRENT_DATE), 1);
SET :ADD_MONTH = ADD_MONTHS(:DATE,3);
SET :DATEHV = DATE('2008-2-28') + 4 MONTHS; SET :DATEHV = ADD_MONTHS('2008-2-28', 4);
SET :DATEHV = DATE('2008-2-29') + 4 MONTHS;
SET :DATEHV = ADD_MONTHS('2008-2-29', 4);