ADD_YEARS

Purpose

This function adds a specified number of years to a date or timestamp.

Syntax

add_years::=

Add Years

Usage Notes

  • Decimals are rounded before adding the number.
  • If the resulting month has fewer days than the day of the date of entry, the last day of this month is returned.
  • For data type TIMESTAMP WITH LOCAL TIME ZONE, this function is calculated within the session time zone.

Example

SELECT ADD_YEARS(DATE '2000-02-29', 1) AY1,
       ADD_YEARS(TIMESTAMP '2005-01-31 12:00:00', -1) AY2;
Result
AY1 AY2
2001-02-28 2004-01-31 12:00:00.000000