The RELATE Keyword in Transitional Constraints |
When using the RELATE keyword in transitional constraints, and primary key or foreign key values are changed run time, the Rules Engine substitutes both the OLD and NEW values of the changed record in this constraint. In specific cases, this default behavior may lead to performance problems, or may result in unexpected violations. To make the behavior of RELATE in transitional constraints more explicit, you can specify whether you want to execute the constraint for the old values or the new values only, by explicitly adding OLD or NEW to the RELATE construct. These keywords can be used with the transition table:
For example: SELECT '' FROM CHILD c, PARENT P RELATE p with NEW c WHERE P.col = 'Y' This results in only the new foreign key values of CHILD being joined with PARENT. While: SELECT '' FROM CHILD c, PARENT P RELATE p with OLD c WHERE P.col = 'Y' This results in only the old foreign key values of CHILD being joined with PARENT. NOTES: Note the following:
|