Search conditions are used in:
- WHERE and HAVING clauses to qualify the selection of rows and groups respectively
- in CHECK clauses to define sets of acceptable values
- in CASE expressions to conditionally return different values
- in CASE and IF statements to control conditional execution in a routine or trigger
- in WHILE and REPEAT statements to control conditional iteration in a routine or trigger
- and in the WHEN clause of a trigger to control conditional execution of the trigger action.
A search condition is built from one or more predicates linked by the logical operators AND and OR and qualified if desired by the operator NOT.
The general syntax of a search condition is:
Search conditions enclosed in parentheses may be used as part of more complex search condition constructions. A search condition is evaluated as follows:
- Conditions in parentheses are evaluated first.
- Within the same level of parentheses, NOT is applied before AND, AND is applied before OR.
- Operators at the same precedence level are applied in an order determined by internal optimization routines.
The result of a search condition is evaluated by combining the results of the component predicates. Each predicate evaluates to true, false or unknown, truth tables are shown in Truth Tables.
WHERE and HAVING clauses select the set of values for which the search condition evaluates to true. CHECK clauses define the set of values for which the search condition does not evaluate to false, i.e. is either true or unknown.
Upright Database Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40