The Java EE 6 Tutorial, Volume I

LIKE Expressions

A LIKE expression determines whether a wildcard pattern matches a string.

The path expression must have a string or numeric value. If this value is NULL, then the value of the LIKE expression is unknown. The pattern value is a string literal that can contain wildcard characters. The underscore (_) wildcard character represents any single character. The percent (%) wildcard character represents zero or more characters. The ESCAPE clause specifies an escape character for the wildcard characters in the pattern value. Table 21–3 shows some sample LIKE expressions.

Table 21–3 LIKE Expression Examples







asentence.word LIKE ’l_se’



aword.underscored LIKE ’\_%’ ESCAPE ’\’


’bar’ NOT LIKE ’12%3’