Corrective Single-Record Constraints |
To define a corrective single-record constraint, write an UPDATE... SET... WHERE... statement that corrects data in one or more of the record's columns. This type of constraint performs a correction on one single record. The syntax of a corrective single-record constraint is: UPDATE table Example Suppose that the Travel Agency system requires default values for return dates of a scheduled tour. This can be handled as follows: if the user leaves the return_date field empty, a date one week later than the (mandatory) start_date is automatically inserted. The following constraint takes care of this: UPDATE schedtour OLD()You can use the OLD() function, or you can set transition properties for the constraint, or both, in which case you turn the constraint into a transitional constraint.
See Also Restrictive Single-Record Constraints |