TRY_TO_BOOLEAN
functionsupportedCore SQL functionsA special version of TO_BOOLEAN that performs the same operation (that is, converts an input expression to a Boolean value), but with error-handling support. If the conversion can’t be performed, TRY_TO_BOOLEAN returns a NULL value instead of raising an error. For more information, see Error-handling conversion functions.
Syntax
TRY_TO_BOOLEAN( <string_expr> )
Parameters
| Name | Required | Description |
|---|---|---|
string_expr | required | A string expression that can be evaluated to a BOOLEAN value. |
Returns
This function returns a value of type BOOLEAN.
Usage notes
- The input argument must be a string expression. The function evaluates the string expression in the following way:
- 'true', 't', 'yes', 'y', 'on', '1' return TRUE.
- 'false', 'f', 'no', 'n', 'off', '0' return FALSE.
- All other strings return NULL.
- The evaluations of the strings are case-insensitive.