Boolean values

A Boolean value represents a truth value; that is, TRUE or FALSE. A Boolean expression or predicate can result in a value of unknown, which is represented by the null value.

The following data types can be cast to the BOOLEAN data type:
  • CHAR or VARCHAR can be cast to a BOOLEAN value:
    • Cast to TRUE: 't' , 'true' , 'y', 'yes' , 'on' ,'1'
    • Cast to FALSE: 'f', 'false', 'n', 'no', 'off', '0'
    A string can use any combination of uppercase and lowercase characters ('yes', 'YES', 'Yes', 'yES', and so on).
  • decimal floating point or binary integer
    • When a value of data type DECFLOAT, SMALLINT, INTEGER, or BIGINT is cast to a BOOLEAN value, the result is TRUE if the value is not zero, and FALSE if the value is zero.