Oracle® Database SQL Reference 10g Release 2 (10.2) Part Number B14200-02 |
|
|
PDF · Mobi · ePub |
ADD_MONTHS
returns the date date
plus integer
months. The date argument can be a datetime value or any value that can be implicitly converted to DATE
. The integer
argument can be an integer or any value that can be implicitly converted to an integer. The return type is always DATE
, regardless of the datatype of date
. If date
is the last day of the month or if the resulting month has fewer days than the day component of date
, then the result is the last day of the resulting month. Otherwise, the result has the same day component as date
.
See Also:
Table 2-10, "Implicit Type Conversion Matrix" for more information on implicit conversionThe following example returns the month after the hire_date
in the sample table employees
:
SELECT TO_CHAR( ADD_MONTHS(hire_date,1), 'DD-MON-YYYY') "Next month" FROM employees WHERE last_name = 'Baer'; Next Month ----------- 07-JUL-1994