Relational expressions—Data extract expressions


A relational expression consists of a comparison (for example, EQ, LT, GE) or testing (for example, IS, ISNOT) relational operator and two associated terms.

For a comparison operator, a term can be a constant, variable, system data value, or an arithmetic expression. For a testing operator, the first term must be a variable and the second term a system data attribute.

The final result of a relational expression is always a one byte hexadecimal value of X'00' for false, or X'01' for true. Parenthesis can be used to group arithmetic expressions to further define the terms of a comparison operator. In the absence of parentheses, there is a defined operator precedence. For additional information, see Operator-precedence-in-an-expression.

Relational expressions are most often used with the WHEN keyword or in the IF clause of a conditional expression. Since the result of a relational operation has a numeric value (X'00' or X'01'), it can be used in an arithmetic expression.

A simple relational expression, consisting of a single term and no operator, is also allowed. The term can be a constant, variable, system data value, or arithmetic expression. In this case, if the term has a value of zero it is considered false. Any non-zero value is treated as true.

The terms in a relational expression can consist of mixed data types. If a comparison operator involves different type terms, they are converted to compatible types to allow a comparison to be performed.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*