Pre-Conditions and Post-Conditions

Previous Next

See Also

The Rules Engine uses pre-conditions and post-conditions in some optimization techniques. These conditions are used in corrective UPDATE constraints.

A constraint has a pre-condition for a given column if, in the WHERE clause of the statement, the column is compared to a constant, or to an expression evaluating to a constant, or to NULL or NOT NULL. Clauses with subqueries and clauses containing OR are never pre-conditions. There may be more than one pre-condition: in this case the pre-conditions are linked by AND.

A constraint has a post-condition for a given column if that column is SET to a constant value, or to an expression evaluating to a constant, or to NULL. A SET clause setting the column to a subquery is never a post-condition. There may be several post-conditions: in this case the SET clause contains two or more parts separated by commas.

Example

Consider the following SQL statement:

UPDATE    <Table>

SET    ColA =

       (SELECT ... FROM <Table2> ... )

,        ColB = 'N'

WHERE    ColA IS NULL

AND    ColC = 'Y'

In this SQL statement, the clauses:

ColA IS NULL

and

ColC = 'Y'

are pre-conditions, while the clause:

ColB IS 'N'

is a post-condition.

NOTE:

In SQL, you can write more than one SET statement using commas as separators as in the example, but you can use the following construct against Oracle only:

...SET (ColA, ColB) = (<Expr>,<Expr>)

Before corrective UPDATE constraints are evaluated, the Rules Engine looks after all pre-conditions and post-conditions of the constraints:

Related Topics

Deactivation Between Constraints

Deactivation Between Incoming Data and Pre- and Post-Conditions

Update On Self Sorting