Was this helpful?
Logical
QUEL has three logical operators: and, or, and not. Not has the highest precedence, followed by and, and or has the least precedence. You can use parentheses to change this behavior. For example, the following expression:
exprA or exprB and exprC
is evaluated as:
exprA or (exprB and exprC)
To change the order of evaluation you must use parentheses:
(exprA or exprB) and exprC
When parenthesized as shown, the DBMS evaluates (exprA or exprB) first, then ands the result with exprC.
You can also use parentheses to change the default evaluation order of a series of expressions combined with the same logical operator. For example, the following expression:
exprA and exprB and exprC
is evaluated as:
(exprA and exprB) and exprC
To change this default left-to-right grouping, use parentheses as follows:
exprA and (exprB and exprC)
The parentheses direct the DBMS Server to and exprB and exprC and then ands that result with exprA.
Note:  There is a per-query limit of 127 or expressions. Because the limit is checked after the query is optimized, it is not obvious that your query has exceeded the limit. The query optimizer converts all expressions to expressions combined using the and logical operator. The following example illustrates this effect of query optimization:
Before optimization
expressionA or (expressionB and expressionC)
After optimization
(expressionA or expressionB) and (expressionA or expressionC)
Note:  As a result of optimization, the number of ors in the query has doubled. To avoid exceeding the limit, be aware of this side-effect of query optimization.
Last modified date: 06/10/2024