SQL/MP Reference Manual
HP NonStop SQL/MP Reference Manual—523352-013
E-28
EXTEND Function
appear, the WAIT_TIME column must be defined with the range DAY TO HOUR.
The inserted row is:
945 1989-10-20:00:00 1990-10-21:00:00 30
This example doubles an INTERVAL value. The result is 5 years, 2 months.
INTERVAL “2-7” YEAR TO MONTH * 2
This example divides an INTERVAL value by another. The result is 36.
INTERVAL value:
INTERVAL "3" DAY / INTERVAL "2" HOUR
This SQLCI example uses the UNITS clause to convert a date-time field to a
numeric field:
>> SELECT START_DATE UNITS MONTH FROM PROJECTS;
(EXPR)
------
2
1
2
10
10
--- 5 row(s) selected.
This programmatic example adds 10 years to the start date and stores the result in
a DATETIME variable. The statement uses the UNITS clause to convert a numeric
10 to a value of type INTERVAL YEAR.
EXEC SQL SELECT STARTDATE + 10 UNITS YEAR
INTO :NEWDATE TYPE AS DATETIME YEAR TO MINUTE
FROM PROJECTS WHERE PROJECTNAME = '920';
EXTEND Function
EXTEND is a function that adjusts the range of fields for a date-time value to a
specified range or to the default range of DATETIME fields.
It returns a value of type DATETIME.
date-time-expression
is an expression that evaluates to a value of type DATETIME, DATE, TIME, or
TIMESTAMP.
EXTEND ( date-time-expression
[ , [start-date-time TO ]end-date-time] )