Restrictive Single-Record Constraints

Previous Next

See Also

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 need only contain:

SELECT    ' ' violation

The alias ("violation") 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.