CONTAINS
functionsupportedCore SQL functionsReturns true if expr1 contains expr2. Both expressions must be text or binary expressions. Tip You can use the search optimization service to improve the performance of queries that call this function. For details, see Search optimization service.
Syntax
CONTAINS( <expr1> , <expr2> )
Parameters
| Name | Required | Description |
|---|---|---|
expr1 | required | The string to search in. |
expr2 | required | The string to search for. |
Returns
Returns a BOOLEAN or NULL: - Returns TRUE if expr2 is found inside expr1. - Returns FALSE if expr2 is not found inside expr1. - Returns NULL if either input expression is NULL.
Usage notes
- For comparisons that match a string against more than one specified pattern, you can use the following functions:
- ILIKE ANY
- LIKE ALL
- LIKE ANY
Collation details
The collation specifications of all input arguments must be compatible. This function does not support the following collation specifications: - pi (punctuation-insensitive). - cs-ai (case-sensitive, accent-insensitive).