ALLBASE/SQL Reference Manual (36216-90216)

Chapter 9 263
Search Conditions
Search Condition
LikePredicate
determines whether an expression contains a particular
character string pattern.
NullPredicate
determines whether a value is null.
QuantifiedPredicate
determines whether an expression bears a particular
relationship to a specified set.
(SearchCondition)
is one of the above predicates, enclosed in parentheses.
Description
Predicates in a search condition are evaluated as follows:
Predicates in parentheses are evaluated first.
NOT is applied to each predicate.
AND is applied next, left to right.
OR is applied last, left to right.
When a predicate contains an expression that is null, the value of the predicate is
unknown. Logical operations on such a predicate result in the following values, where a
question mark (?) represents the unknown value:
Figure 9-1. Logical Operations on Predicates Containing NULL Values
When the search condition for a row evaluates to unknown, the row does not satisfy the
search condition and the row is not operated on. Check constraints are an exception; see
the section on CREATE TABLE or CREATE VIEW.
You can compare only compatible data types. INTEGER, SMALLINT, DECIMAL,
FLOAT, and REAL are compatible. CHAR and VARCHAR are compatible, regardless of
length. You can compare items of type DATE, TIME, DATETIME, and INTERVAL to
literals of type CHAR or VARCHAR. ALLBASE/SQL converts the literal before the
comparison. BINARY and VARBINARY are compatible, regardless of length.
You cannot include a LONG BINARY or LONG VARBINARY data type in a predicate
except within a long column function.
•A
SubQuery
expression cannot appear on the left-hand side of a predicate.
Refer to Chapter 7 , “Data Types,” and Chapter 8 , “Expressions,” for information
concerning value extensions and type conversion during comparison operations.