Null values in query for iseries, Comparison tests in query for iseries – IBM ISERIES SC41-5210-04 User Manual

Page 107

Advertising
background image

Note: If you are sending queries between countries that use the comma for a decimal separator, put a

blank after each comma separating the offset and length in the SUBSTR function and between
numeric values in a list in the VALUE function. Press F17 to show which decimal separator to use
in the query (see “Displaying the format of constants in Query for iSeries” on page 17).

Date, time, timestamp constants as values in Query for iSeries

Date, time, or timestamp constants are the same as the constants used on the Define Result Fields
display. See “Date, time, and timestamp expressions in Query for iSeries” on page 66. You can see what is
allowed for OS/400 date and time formats and separators by pressing F17 (see “Displaying the format of
constants in Query for iSeries” on page 17).

Null values in Query for iSeries

Null is a valid value for all data types on record selection. IS and ISNOT are valid tests for the keyword
NULL.

Comparison tests in Query for iSeries

You can specify these tests in comparisons:

Test

Description

EQ

Equal. Use this test to determine if the contents of the field and the value are equal.

NE

Not equal. Use this test to determine if the contents of the field and the value are not equal.

GT

Greater than. Use this test to determine if the contents of the field is greater than the value.

LT

Less than. Use this test to determine if the contents of the field is less than the value.

GE

Greater than or equal. Use this test to determine if the contents of the field is greater than or equal
to the value.

LE

Less than or equal. Use this test to determine if the contents of the field is less than or equal to
the value.

RANGE

Range. Use this test to determine if the contents of the field is within a range that you have
specified for the value.

LIST

List. Use this test to determine if the contents of the field is equal to one of the values in a list.

NLIST Not List. Use this test to determine if the contents of the field is not equal to any of the values in a

list.

LIKE

Like. Use this test to determine if the contents of the field has a pattern similar to the value.

NLIKE Not Like. Use this test to determine if the contents of the field has a pattern that is not similar to

the value.

IS

Is. Use this test to determine if a field is null. The only valid value is NULL or null.

ISNOT

Is not. Use this test to determine if the contents of the field is not null.

Character fields and constants are compared character by character for all tests except LIKE, NLIKE, IS,
and ISNOT.
v If two fields or a field and a constant being compared are not the same length, Query treats the shorter

field as if it has enough blanks at the end to make both fields the same length.

v The collating sequence determines greater than and less than conditions (for GT, GE, LT, LE, and

RANGE comparisons). For more information on collating sequences, see Chapter 9, “Selecting a
collating sequence in Query for iSeries”
.

Chapter 7. Selecting records in Query for iSeries

95

Advertising