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    '' violated

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

Example

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

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

Single-record constraints

Corrective single-record constraints

Restrictive multi-record constraints

Corrective multi-record constraints