Logical Operators
The following logical operators
logical operators
are supported, listed here in their evaluation
precedence:
NOT
Boolean NOT
Boolean NOT
operation
~
Boolean NOT
Boolean NOT
operation
AND
Boolean AND
Boolean AND
operation
OR
Boolean OR
Boolean 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 is bypassed.
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');
An XOR Operator
XOR Operator
The following function can be used to perform an XOR operation on 2
Boolean values:
BOOLEAN XOR(BOOLEAN cond1, BOOLEAN cond2) :=
(cond1 OR cond2) AND NOT (cond1 AND cond2);