Sie sind auf Seite 1von 58

Definition of Normalization

The normalization process is explained more formally as follows.


When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.

ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou

gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont

h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.

ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH


The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.

Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.

ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou

gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont

h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.

ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH


The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.

Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.

ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou

gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont

h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.

ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH


The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.

Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.

ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou

gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont

h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.

ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH


The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.

Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.

ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou

gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont

h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.

ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH


The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.

Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.

ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou

gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont

h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.

ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH


The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.

Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.

ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou

gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont

h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.

ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH


The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.

Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.

ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou

gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont

h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.

ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH


The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.

Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.

ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou

gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont

h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.

ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH


The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.

Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.

ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou

gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont

h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.

ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH


The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.

Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.

ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou

gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont

h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.

ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH


The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.

Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.

ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou

gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.
Definition of Normalization
The normalization process is explained more formally as follows.
When the DAY field of the source date_expression or timestamp_expression is grea
ter than the
resulting target DAY field, ADD_MONTHS sets DD equal to the last day of the mont
h + n to
normalize the reported date or timestamp.
Define date_expression as YYYY-MM-DD for simplicity.
For a given date_expression, you can then express the syntax of ADD_MONTHS as fo
llows.
ADD_MONTHS('YYYY-MM-DD' , n)
Recalling that n can be negative, and substituting YYYY-MM-DD for date_expression,
you
can redefine ADD_MONTHS in terms of ANSI SQL:2008 dates and intervals as follows
.
ADD_MONTHS('YYYY-MM-DD', n) = 'YYYY-MM-DD' INTERVAL 'n' MONTH
The equation is true unless an invalid date such as 1999-09-31 results, in which
case the ANSI
expression traps the invalid date exception and returns an error.
ADD_MONTHS, on the other hand, processes the exception and returns a valid, thou
gh not
necessarily expected, date. The algorithm ADD_MONTHS uses to produce its normali
zed
result is as follows, expressed as pseudocode.

Das könnte Ihnen auch gefallen