IS_TRUE Function
Description
The IS_TRUE function determines whether the value of an expression is true. This function supports boolean and string types, and can recognize various string formats that represent true.
Parameters
expr:BOOLEANorSTRINGtype, the expression to evaluate.
Return Type
- Returns
BOOLEANtype. - Returns
trueif the expression value istrueor a string representingtrue. - Returns
falseif the expression value isfalseor a string representingfalse. - Returns
falseif the expression value isNULL.
Notes
- The
IS_TRUEfunction recognizes the following strings astrue: 't', 'true', '1', 'yes'. - The
IS_TRUEfunction recognizes the following strings asfalse: 'f', 'false', '0', 'no'. - Difference from using
exprdirectly:is_true(NULL)returnsfalse, whileNULLin a boolean context is handled specially. - String matching is case-insensitive.
Examples
- Boolean evaluation
- String evaluation (supports multiple formats)
- Using in a WHERE clause
