CONTAINS
contains(expr, subExpr)
Description
The contains
function is used to determine whether the string or binary expression subExpr
exists within the string or binary expression expr
. If subExpr
exists within expr
, it returns true
; otherwise, it returns false
.
Parameters
expr
: The string or binary expression to be searched.subExpr
: The substring or binary expression to be found withinexpr
.
Return Value
Returns a boolean value indicating whether subExpr
exists within expr
.
Example Usage
- Determine if "HelloWorld" contains "Hello":
- Determine if "123456" contains "34":
- Determine whether "示例文本" contains "本" (Chinese character):
Notes
- When
expr
orsubExpr
isNULL
, thecontains
function will returnNULL
.
By using the contains
function, you can easily implement the detection of specific substrings or binary patterns in data queries, thereby improving the flexibility and efficiency of data processing.