HP 3000 Manuals

Using the Date/Time ADD_MONTHS Function [ ALLBASE/SQL C Application Programming Guide ] MPE/iX 5.0 Documentation


ALLBASE/SQL C Application Programming Guide

Using the Date/Time ADD_MONTHS Function 

This function allows you to add an integer number of months to a DATE or
DATETIME column.  Do so by indicating the number of months as a positive,
negative, or unsigned integer value.  (An unsigned value is assumed
positive.)  Also, you can specify the integer in a host variable of type
INTEGER.

The ADD_MONTHS function can be used in both input and output operations
as shown in Table 11-1 .

Following is the general syntax for the ADD_MONTHS function:

{ADD_MONTHS (ColumnName, IntegerValue)}

As with date/time output functions, use the ADD_MONTHS function with any
DML operation listed in Table 11-2  with one exception.  In the case
of a [BULK] INSERT command, the ADD_MONTHS function is limited to use in
the select list and the WHERE clause of a Type 2 INSERT command.

Example ADD_MONTHS Function 

Perhaps you want to increment each date in the TestDate column by one
month in the ManufDB.TestData table of the manufacturing database.  The
following command could be used:

          UPDATE ManufDB.TestData
             SET TestDate = ADD_MONTHS (TestDate, 1);



MPE/iX 5.0 Documentation