ALLBASE/SQL Reference Manual (36216-90216)

272 Chapter9
Search Conditions
LIKE Predicate
LIKE Predicate
A LIKE predicate determines whether an expression contains a given pattern. The
predicate evaluates to TRUE if an expression contains the pattern. If the NOT option is
used, the predicate evaluates to TRUE if the expression does not contain the pattern.
Scope
SQL Data Manipulation Statements
SQL Syntax
Expression
[NOT]LIKE {
‘PatternString’
:HostVariable1
[[INDICATOR]:
IndicatorVariable1
]
?
:
LocalVariable1
:
ProcedureParameter1
}
[ESCAPE{
‘EscapeChar’
:
HostVariable2
[[INDICATOR]:
IndicatorVariable2
]
?
:
LocalVariable2
:
ProcedureParameter2
}]
Parameters
Expression
specifies a value used to identify columns, screen rows, or
define new column values. The syntax of expressions is
presented in the "Expressions" chapter. Only CHAR and
VARCHAR expressions are valid in LIKE predicates.
Date/time columns cannot be referred to directly; however,
they can be placed inside the conversion function
TO_CHAR and be converted to a CHAR value.
Expression
cannot be a subquery.
NOT reverses the value of the predicate.
PatternString
describes what you are searching for in the expression.
The pattern can consist of characters only (including
digits). For example, NAME LIKE 'Annie' evaluates to
true only for a name of Annie. Uppercase and lowercase
are significant.
You can also use the predicate to test for the existence of a
partial match, by using the following symbols in the
pattern:
_ represents any single character; for example, BOB and
TOM both satisfy the predicate NAME LIKE '_O_'.