Search conditions are used in:
HAVINGclauses to qualify the selection of rows and groups respectively
CHECKclauses to define sets of acceptable values
CASEexpressions to conditionally return different values
IFstatements to control conditional execution in a routine or trigger
REPEATstatements to control conditional iteration in a routine or trigger
WHENclause 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
ORand qualified if desired by the operator
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,
NOTis applied before
ANDis applied before
- 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.
HAVINGclauses select the set of values for which the search condition evaluates to true.
CHECKclauses define the set of values for which the search condition does not evaluate to false, i.e. is either true or unknown.
WHEREcondition determines which rows to select, for example:SELECT * FROM customer_details WHERE country_code = 'SE'
HAVINGclause restricts the selection of groups. A
HAVINGclause may use a set function on the left-hand side of a comparison. See Mimer SQL User's Manual, Grouped Set Functions - the GROUP BY Clause.
This section summarizes standard compliance concerning search conditions.
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40