Progress
SQL-92
Guide and Reference
LIKE Predicate
The LIKE predicate searches for strings that have a certain pattern. The pattern is specified after the LIKE keyword in a string constant. The pattern can be specified by a string in which the underscore ( _ ) and percent sign ( % ) characters have special semantics.
Use the ESCAPE clause to disable the special semantics given to the characters ( _ ) and
( % ). The escape character specified must precede the special characters in order to disable their special semantics.This is the syntax for a like_predicate:
NOTES
EXAMPLE
- The column name specified in the
LIKE
predicate must refer to a character string column.- A percent sign ( % ) in the pattern matches zero or more characters of the column string.
- A underscore symbol ( _ ) in the pattern matches any single character of the column string.
- The
LIKE
predicate is multi-byte enabled. Thestring_constant
and theescape_character
may contain multi-byte characters, and theescape_character
can be a multi-byte character. A percent sign ( % ) or an underscore ( _ ) in thestring_constant
can represent a multi-byte character. However, the percent sign or underscore itself must be the single-byte ASCII encoding.This example illustrates three ways to use the LIKE predicate:
In the first LIKE clause, for all strings with the substring ’Computer’ the predicate evaluates to true. In the second LIKE clause, for all strings which are exactly three characters long the predicate evaluates to true. In the third LIKE clause the backslash character ( \ ) is specified as the escape character, which means that the special interpretation given to the underscore character ( _ ) is disabled. The pattern evaluates to TRUE if the item_name column has embedded underscore characters.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |