Like CCL Operators

LIKE operators are supported by WHERE clause expressions to match WHERE clause string expressions to stings that closely resemble each other.

WHERE clause expressions support the use of the LIKE and REGEXP_LIKE operators to match WHERE clause string expressions to strings that closely resemble each other but don't exactly match.

Operator

Syntax

Purpose

LIKE

compare_expresion LIKE pattern_match_expression

Matches the pattern specified in pattern_match_expression to the contents of compare_expression and returns a value of true or false. Both compare_expression and pattern_match_expression must evaluate to a STRING type. The LIKE operator returns a value of true if compare_expression matches pattern_match_expression, or false if it does not.

compare_expression and pattern_match_expression can contain wild cards, where the percent sign (%) matches any length string, and the underscore (_) matches any single character. If you want to use % or _ as a literal in your pattern, instead of as a wild card, preface these characters with a backslash (\_ or \%): for example, x\_y. You must also preface the backslash character with a backslash (\\) if you want to use it as a literal in your pattern. Using a backslash character as the last character in the pattern, or before a character other than an underscore, percent sign, or backslash, generates an error.

REGEXP_LIKE

compare_expression REGEXP_LIKE POSIX_regular_expression

Matches the pattern specified in POSIX_regular_expression to the contents of compare_expression and returns a value of true if they match or false if they do not. Both compare_expression and POSIX_regular_expression must evaluate to a STRING type.

The following example matches any row with a value in the column StockName that contains "Corp" in any position.

INSERT INTO OutStream 
SELECT Trades.StockName 
FROM Trades 
WHERE Trades.StockName LIKE "%Corp%"