Add_Months Function; Examples Of Add_Months - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

ADD_MONTHS Function

The ADD_MONTHS function adds the integer number of months specified by int_expr to
datetime_expr and normalizes the result.
ADD_MONTHS is a Neoview extension.
ADD_MONTHS (datetime_expr, int_expr [, int2
datetime_expr
is an expression that evaluates to a datetime value of type DATE or TIMESTAMP. The return
value is the same type as the datetime_expr. See
int_expr
is an SQL numeric value expression of data type SMALLINT or INTEGER that specifies the
number of months. See
int2
is an unsigned integer constant. If int2 is omitted or is the literal 0, the normalization is the
standard normalization. If int2 is the literal 1, the normalization includes the standard
normalization and if the starting day (the day part of datetime_expr) is the last day of the
starting month, then the ending day (the day part of the result value) is set to the last valid
day of the result month. See
Expressions" (page

Examples of ADD_MONTHS

This function returns the value DATE '2001-03-31':
ADD_MONTHS(DATE '2001-02-28', 1, 1)
This function returns the value DATE '2001-03-28':
ADD_MONTHS(DATE '2001-02-28', 1, 0)
This function returns the value DATE '2000-03-28':
ADD_MONTHS(DATE '2000-02-28', 1, 1)
This function returns the timestamp '2005-02-28 00:00:00':
ADD_MONTHS(timestamp'2004-02-29 00:00:00',12,1)
288
SQL Functions and Expressions
"Numeric Value Expressions" (page
"Standard Normalization" (page
217).
])
"Datetime Value Expressions" (page
217).
279). See
"Numeric Value
210).

Advertisement

Table of Contents
loading

Table of Contents