Restrictive Single-Record Constraints

Previous Next

A restrictive single-record constraint is a SELECT... FROM... WHERE... statement that selects the data that is not supposed to be in your database. The SELECT clause must be no longer than:

SELECT    '' violation


The alias ("violated") is optional. The Rules Engine ignores any other information in the SELECT clause.

The syntax of a restrictive single-record constraint is:

SELECT    '' violation
FROM      table
WHERE     condition


In the Travel Agency application, members of staff cannot be coaches of themselves. The following constraint takes care of this:

SELECT    '' violation
FROM      staff
WHERE     person_id = coached_by


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

Single-Record Constraints

Corrective Single-Record Constraints

Restrictive Multi-Record Constraints

Corrective Multi-Record Constraints