ADD_MONTHS is one of the vital Date/Time functions of Oracle. It is used to get a date with a specified number of months added. The ADD_MONTHS function is supported in the various versions of the Oracle/PLSQL, including, Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i and Oracle 8i.
Syntax:
ADD_MONTHS ( date, number_months )
Parameters:
date: It is used to specify the starting date.
number_months: It is used to specify the number of months to add.
Example 1:
ADD_MONTHS ( ‘26-JUN-19’, 2) |
Output:
‘26-AUG-19’
Explanation:
The result is the date two months from the starting date.
Example 2:
ADD_MONTHS ( ‘26-JUN-19’, -2) |
Output:
‘26-APR-19’
Explanation:
The result is the date two months before the starting date.