Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Can a constraint use a sql statement?

Re: Can a constraint use a sql statement?

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Thu, 12 Oct 2000 22:53:56 +0200
Message-ID: <971391862.26662.0.pluto.d4ee154e@news.demon.nl>

Doesn't make sense.
This is a so-called business-rule which you can resolve by a) a trigger
b) inserting or updating a view with check option

Regards,

Sybrand Bakker, Oracle DBA

"Brian Tkatch" <SPAMBLOCK.Maxwell_Smart_at_ThePentagon.com.SPAMBLOCK> wrote in message news:39e60d01.539274921_at_news.alt.net...
> I want to add a constraint a to a table checking that its foriegn key
> refrences a record that has specific data in its record.
>
>
> A
> ==
> Id (Foriegn Key to B.Id)
>
>
> B
> ==
> Id (Primary Key)
> Type (Foriegn Key to C.Id)
>
> C
> ==
> Id (Primary Key)
> Name
>
>
>
> The contraint would be on A.Id that B.Type = C.Id where C.Name =
> 'Data';
>
>
> CHECK (
> A.Id IN
> (SELECT Id FROM B WHERE Type IN
> (SELECT Id FROM C WHERE Name = 'Data'))
> )
> )
>
>
> Does that make any sense? Is it possible to add?
>
> Brian
>
Received on Thu Oct 12 2000 - 15:53:56 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US