Re:database constraints
Date: Thu, 16 Jun 1994 05:55:49 GMT
Message-ID: <CrH6yK.9ry_at_iceonline.com>
>We have an application that needs more than a foreign key ,
Ken Levine
>the ability to restrict codes to those marked current in
>another table.
>
>This requires a constraint along the lines of
>CONSTRAINT check_current
> CHECK dept_code EXISTS IN ( select d.dept_code
> from division d
> where retired_ind is null )
>
>So the table being defined has a constraint that column
>dept_code must be a current division code (not retired)
>
>Can someone advise when integrity constraints will be extended
>in this direction ?
>
>Stephen Gerard
>
Triggers can do this right now and it doesn't take much more work. Just
define a before insert or update of dept_code on row trigger that
does this validation. As long as the trigger is enabled on the table the
condition must hold.