SQL/MX 2.x Reference Manual (H06.04+)

SQL/MX Language Elements
HP NonStop SQL/MX Reference Manual540440-003
6-93
LIKE Predicate
LIKE Predicate
Considerations for LIKE
Examples of LIKE
The LIKE predicate searches for character strings that match a pattern.
match-value
is a character value expression that specifies the set of strings to search for that
match the pattern.
pattern
is a character value expression that specifies the pattern string for the search.
esc-char-expression
is a character value expression that must evaluate to a single character. The
escape character value is used to turn off the special meaning of percent and
underscore. See Wild Card Characters on page 6-94.
See Character Value Expressions on page 6-37.
Considerations for LIKE
Comparing the Value to the Pattern
The values you compare must be character strings. Lowercase and uppercase letters
are not equivalent. To make lowercase letters match uppercase letters, use the
UPSHIFT function. A blank is compared in the same way as any other character.
When a LIKE Predicate Is True
When you reference a column, the LIKE predicate is true if the pattern matches the
column value. If the value of a column reference is null, the LIKE predicate evaluates
to unknown for that row. If the values you compare are both empty strings (that is,
strings of zero length), the LIKE predicate is true.
Using NOT
If you specify NOT, the predicate is true if the value you are comparing does not match
any string to which you are comparing or is not the same length as any string to which
you are comparing. For example, NAME NOT LIKE '_Z' is true if the string is not two
characters long or the last character is not Z.
In a search condition, the predicate NAME NOT LIKE '_Z' is equivalent to NOT (NAME
LIKE '_Z').
match-value [NOT] LIKE pattern [ESCAPE esc-char-expression]