EXTEND Function
The EXTEND function adjusts the precision of a DATETIME or DATE value.
The DATETIME or DATE expression that is its first argument cannot be a quoted string representation of a DATE value.
If you do not specify first and last qualifiers, the default qualifiers are YEAR TO FRACTION(3).
If the expression contains fields that are not specified by the time-unit qualifiers, those fields are discarded.
If the first qualifier specifies a larger (that
is, more significant) time unit than what exists in the expression,
the new fields are filled in with values returned by the CURRENT function.
If the last qualifier specifies a smaller time unit (that is,
less significant) than what exists in the expression, the new fields
are filled in with constant values. A missing MONTH or DAY field is
filled in with 1
, and the missing HOUR to FRACTION
fields are filled in with 0
.
EXTEND (call_dtime, YEAR TO SECOND)
EXTEND (DATETIME (2009-8-1) YEAR TO DAY, YEAR TO MINUTE)
- INTERVAL (720) MINUTE (3) TO MINUTE
UPDATE cust_calls SET call_dtime = call_dtime -
(EXTEND(call_dtime, HOUR TO MINUTE) - DATETIME (11:00)
HOUR TO MINUTE) WHERE customer_num = 106;
Subtracting 11:00
from
the DATETIME HOUR TO MINUTE value returned by EXTEND yields
a positive or negative INTERVAL HOUR TO MINUTE value. Subtracting
this difference from the original value in the call_dtime column
forces the updated hour and minute time unit values
to 11:00
in the cust_calls.call_dtime column.