BOOLEAN scalar function

The BOOLEAN function returns the actual Boolean value that corresponds to a non-Boolean representation of a Boolean value.

Read syntax diagramSkip visual syntax diagram BOOLEAN ( numeric-expressionstring-expression )

The schema is SYSIBM.

numeric-expression
An expression that returns a binary integer or floating decimal value. The result is TRUE if the returned value is non-zero and FALSE if it is zero.
string-expression
An expression that returns a character-string or Unicode graphic-string representation of a Boolean value. Leading and trailing blanks are eliminated from the string before it is evaluated.

The returned string must be a valid representation of a Boolean value as described in Boolean values (SQLSTATE 22018).

The result of the function is the same BOOLEAN value that would result from the expression:
CAST(string-expression AS BOOLEAN)
If the argument can be null, the result can be null; if the argument is null, the result is the null value.

Examples

  • Example 1: The following statement returns a value of data type BOOLEAN with the value TRUE.
       values BOOLEAN(1)
  • Example 2: The following statement returns a value of data type BOOLEAN with the value FALSE.
       values BOOLEAN('NO')
  • Example 3: The following statement returns a value of data type BOOLEAN with the value TRUE.
       values BOOLEAN('Yes')