Skip to main content

BOOL

This function is used to cast data to the BOOL data type.

Syntax​

BOOL ( arg )  

arg
The value to be cast. The value can be a Numeric data type.

Return Value​

Returns the BOOL representation of the value provided.

Remarks​

  • A value of 0 represents false , and any non-zero value is converted to true.

Examples​

This example demonstrates casting different numerics to a BOOL.

SELECT BOOL(42) AS nonzero_int, BOOL(98.4) AS nonzero_decimal,
BOOL(0) AS zero_int, BOOL(0.0) AS zero_decimal;

Response:

nonzero_int [BOOL]     nonzero_decimal [BOOL]     zero_int [BOOL]        zero_decimal [BOOL]
true true true true