Categories:

Semi-structured and structured data functions (Cast)

AS_BOOLEAN¶

Casts a VARIANT value to a BOOLEAN value.

See also:

AS_<object_type>

Syntax¶

AS_BOOLEAN( <variant> )
Copy

Arguments¶

variant

This should be an expression that evaluates to a VARIANT that contains a valid BOOLEAN value.

Returns¶

The data type of the returned value is BOOLEAN.

Examples¶

Here is a simple example of using AS_BOOLEAN:

SELECT AS_BOOLEAN(TO_VARIANT(TRUE)), AS_BOOLEAN(TO_VARIANT(FALSE)), AS_BOOLEAN(TO_VARIANT(NULL));
+------------------------------+-------------------------------+------------------------------+
| AS_BOOLEAN(TO_VARIANT(TRUE)) | AS_BOOLEAN(TO_VARIANT(FALSE)) | AS_BOOLEAN(TO_VARIANT(NULL)) |
|------------------------------+-------------------------------+------------------------------|
| True                         | False                         | NULL                         |
+------------------------------+-------------------------------+------------------------------+
Copy