Thursday, January 10, 2013

Add_Months Function


In Oracle/PLSQL, the add_months function returns a date plus n months.

Syntax

The syntax for the add_months function is:
add_months( date1, n )
date1 is the starting date (before the n months have been added).
n is the number of months to add to date1.

Applies To

  • Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i

For Example

add_months('01-Aug-03', 3)would return '01-Nov-03'
add_months('01-Aug-03', -3)would return '01-May-03'
add_months('21-Aug-03', -3)would return '21-May-03'
add_months('31-Jan-03', 1)would return '28-Feb-03'