IBM SC41-5210-04 manual Date, time, and timestamp expressions in Query for iSeries

Models: SC41-5210-04

1 294
Download 294 pages 6.42 Kb
Page 78
Image 78

The actual length of the result depends on the number of characters in the argument. Each character of the argument determines a character of the result. Regardless of the CCSID, every double-byte code point in the argument is considered a DBCS character, and every single-byte code point in the argument is considered an SBCS character with the exception of the EBCDIC mixed data shift codes X’0E’ and X’0F’.

vIf the nth character of the argument is a DBCS character, the nth character of the result is that DBCS character.

vIf the nth character of the argument is an SBCS character that has an equivalent DBCS character, the nth character of the result is that equivalent DBCS character.

vIf the nth character of the argument is an SBCS character that does not have an equivalent DBCS character, the nth character of the result is the DBCS substitution character.

The equivalence of SBCS and DBCS characters depends on M.

If the result is UCS2 then, each character of the argument determines a character of the result. The nth character of the result is the UCS2 equivalent of the nth character of the argument.

Date, time, and timestamp expressions in Query for iSeries

Date, time, and timestamp data types and values can be assigned to result fields. A date, time, or timestamp expression for a result field can contain the following, alone or in combination:

vDate, time, or timestamp field names (names of fields that contain date, time, or timestamp values)

vCharacter constants (SBCS or DBCS characters enclosed in apostrophes— see examples and rules under “Query for iSeries character expressions” on page 60.)

vDate, time, and timestamp functions and operations (one or more of the following functions and arithmetic operations):

+(Addition)

(Subtraction)

CHAR CURRENT VALUE DATE DAY DAYS MONTH YEAR TIME HOUR MINUTE SECOND MICROSECOND

TIMESTAMP

v Durations (a length of time, represented by a labeled duration, date duration, time duration, or timestamp duration— see “Durations in Query for iSeries” on page 73.)

Character constants can represent date, time, or timestamp values when used with date, time, or timestamp fields or functions. They can be used in expressions and treated like a date, time or timestamp. For example, a date constant may be subtracted from a date field.

A date, time, or timestamp expression for a result field can contain the following either alone or in combination:

66Query for iSeries Use V5R2

Page 78
Image 78
IBM SC41-5210-04 manual Date, time, and timestamp expressions in Query for iSeries