Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Question on Check Constraints
Hi, Kevin,
Table check constraints will not allow you to prevent the same key value from appearing in 2 different tables since you cannot use SQL subqueries in check constraints. What you could do is set up 2 database before insert triggers, each of which makes sure that the key value for the current record does not appear in the 'other' table. If it does, the insertion can be made to fail.
In article <iqVE2.62$gF3.151_at_news15.ispnews.com>,
"Kevin Donovan" <kdonovan_at_brainiac.com> wrote:
> I have a question regarding the construction of check constraints in Oracle
> 8.X. Here is the situation: I have 2 tables in an instance, both have the
> same name but different owners. I have a business rule that states that the
> same key cannot exist in both these tables. Is it possible with a check
> constraint to enforce this. If it is, any tips you have on creating this
> would be very helpful.
>
> Thanks
>
> Kevin
>
>
-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Mon Mar 08 1999 - 16:20:16 CST
![]() |
![]() |