DAY
DAYS
MONTH
YEAR
v A time expression performs an operation on a time. Time expressions can contain the following
operators or functions:
+ (Addition)
− (Subtraction)
CHAR
TIME
HOUR
MINUTE
SECOND
MICROSECOND
v A timestamp expression performs an operation on a timestamp. Timestamp expressions can contain
the following operators or functions:
+ (Addition)
− (Subtraction)
CHAR
TIMESTAMP
If any argument can be null, the result field can be null. If any argument is null, the result is null.
Query for iSeries numeric expressions
To define a numeric result field (that is, a result field that contains numbers) for your query, you need to
follow the rules for creating numeric expressions. A numeric expression for a result field can contain the
following, alone or in combination:
v Numeric field names (names of fields that contain numbers). You can use the names of numeric fields
listed on the lower part of the display (numeric fields have numbers shown in the Len and Dec columns)
and the names of previously defined numeric result fields. For example, you can multiply two numeric
fields and put the total in a result field named AMOUNT:
AMOUNT = QUANTITY * PRICE
v Numeric constants (any numbers such as 4 or −12.5). The rules for using numeric constants are:
– The total length can be no more than 31 digits. (For a single-precision floating-point constant, the
total length can be no more than nine digits. For a double-precision floating-point constant, the total
length can be no more than 17 digits.) This includes the digits both to the left and right of the
decimal point but does not include the decimal point. All the digits can be to the right of the decimal
point.
– Use the correct decimal separator. Press F17 to show the decimal separator that must be used (see
“Displaying the format of constants in Query for iSeries” on page 17).
– Do not use a currency symbol (like $5000), and do not use thousands separators (like 5,000).
v Numeric functions. The VALUE function returns the first value that is not null. See “VALUE Query for
iSeries function” on page 62.
Other examples of numeric expressions for a field named AMOUNT are:
QUANTITY
5
5+6
5 + QUANTITY
Chapter 5. Defining result fields in Query for iSeries 59