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:

SYNTAX
column_name  [  NOT  ] LIKE string_constant  [  ESCAPE escape_character  ] 

NOTES

EXAMPLE

This example illustrates three ways to use the LIKE predicate:

cust_name LIKE ’%Computer%’
 
cust_name LIKE ’___’
 
item_name LIKE ’%\_%’ ESCAPE ’\’  

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