STARTSWITH
Description
The STARTSWITH
function is used to determine whether a string starts with another specified string. If the condition is met, it returns the Boolean value TRUE
; otherwise, it returns FALSE
. This function supports both string and binary data and is applicable to string processing and pattern matching scenarios.
Syntax
Parameters
expr
: ASTRING
orBINARY
expression representing the target data to be checked.startExpr
: ASTRING
orBINARY
expression representing the starting pattern for comparison.
Return Value
- The return value is of Boolean type (
TRUE
orFALSE
). - If either
expr
orstartExpr
isNULL
, the function returnsNULL
. - If
startExpr
is an empty string or empty binary data, the function returnsTRUE
.
Examples
Example 1: String pattern matching
Example 2: Case sensitivity
Example 3: Including NULL values
Example 4: Empty string or empty binary