TO_BOOLEAN

Syntax

Description of the illustration to_boolean.gif

Purpose

Use TO_BOOLEAN to explicitly convert character value expressions or numeric value expressions to boolean values.

If expr is a string, it must evaluate to the allowed string inputs. See Table 2-6.

expr can take one of the following types, or null:

Examples

SELECT TO_BOOLEAN(0), TO_BOOLEAN('true'), TO_BOOLEAN('no');

The output is:

TO_BOOLEAN(0)   TO_BOOLEAN('TRUE'  TO_BOOLEAN('NO'
-------------   -----------------  --------------
false           true               false
SELECT TO_BOOLEAN(1) FROM DUAL;

The output is:

TO_BOOLEAN(1)
-------------
true

See Also: