Boolean predicate
A Boolean predicate returns the truth value of a Boolean expression.
- boolean-expression
- An expression that returns a built-in Boolean, character string, graphic string, integer, or decimal floating-point data type. A character string, graphic string, integer, or decimal floating-point value is cast to Boolean. For more information about converting character string, graphic string, integer, and decimal floating-point to Boolean, see BOOLEAN.
Null values are treated differently by different predicates:
- The IS TRUE predicate returns:
- TRUE when the truth value of the value returned by boolean-expression is TRUE
- FALSE when the truth value is FALSE or NULL
- The IS FALSE predicate returns:
- TRUE when the truth value of the value returned by boolean-expression is FALSE
- FALSE when the truth value is TRUE or NULL
- The IS NOT TRUE predicate returns:
- TRUE when the truth value of the value returned by boolean-expression is FALSE or NULL
- FALSE when the truth value is TRUE
- The IS NOT FALSE predicate returns:
- TRUE when the truth value of the value returned by boolean-expression is TRUE or NULL
- FALSE when the truth value is FALSE
Alternative syntax: The keyword ON can be used instead of TRUE; OFF can be used instead of FALSE.
Example
The following statement returns the rows from TB1 that have not had the Boolean column SHIPPED set to TRUE.
SELECT * FROM TB1 WHERE SHIPPED IS NOT TRUE