Variable-text searches

You can use the keywords LIKE and MATCHES for variable-text queries that are based on substring searches of fields. Include the keyword NOT to indicate the opposite condition.

The keyword LIKE complies with the ISO/ANSI standard for SQL, whereas MATCHES is the HCL® OneDB® extension.

Variable-text search strings can include the wildcard symbols that are listed with the keywords LIKE or MATCHES in the following table.

The following table shows the wildcard symbols that you can use with the keyword LIKE and the keyword MATCHES. The symbol is followed by an explanation about what the symbol does.

Keyword Symbol Explanation
LIKE % Evaluates to zero or more characters
LIKE _ Evaluates to a single character
LIKE \ Escapes special significance of next character
MATCHES * Evaluates to zero or more characters
MATCHES ? Evaluates to a single character (except null)
MATCHES [ ] Evaluates to a single character or range of values
MATCHES \ Escapes special significance of next character

You cannot test BLOB, CLOB, TEXT, or BYTE columns with the LIKE or MATCHES operators.