Logical Operators

The following logical operators are supported, listed here in their evaluation precedence:

NOTBoolean NOT operation
~Boolean NOT operation
ANDBoolean AND operation
ORBoolean OR operation

Logical Expression Grouping

When a complex logical expression has multiple OR conditions, you should group the OR conditions and order them from least complex to most complex to result in the most efficient processing.

If the probability of occurrence is known, you should order them from the most likely to occur to the least likely to occur, because once any part of a compound OR condition evaluates to TRUE, the remainder of the expression can be bypassed. However, this is not guaranteed. This is also true of the order of MAP function conditions.

Whenever AND and OR logical operations are mixed in the same expression, you should use parentheses to group within the expression to ensure correct evaluation and to clarify the intent of the expression. For example consider the following:

isCurrentRevolv := trades.trd_type = 'R' AND
                   trades.trd_rate = '0' OR
                   trades.trd_rate = '1';

does not produce the intended result. Use of parentheses ensures correct evaluation, as shown below:

isCurrentRevolv := trades.trd_type = 'R' AND
          (trades.trd_rate = '0' OR trades.trd_rate = '1');