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

Home -> Community -> Usenet -> c.d.o.server -> Re: Strange contraint help please...

Re: Strange contraint help please...

From: Henning Follmann <H.Follmann_at_gmx.de>
Date: 29 Nov 2001 17:15:57 -0500
Message-ID: <87zo55fcki.fsf@mobile.follmann-net>


harry <a_at_abc.com> writes:

> Using Oracle 8i on win NT 4 server(sp6a)
>
> How can I get around this problem? - I have 3 tables with one column each -
>
> A
> =
> ID number(8)
>
> B
> =
> ID number(8)
>
> C
> =
> ID number(8)
>
>
> containin data
>
> A
> =
> 1
> 2
> 3
>
> C
> =
> 4
> 5
> 6
>
> B
> =
> 1
> 2
> 3
> 4
> 5
> 6
>
> how can I add a referential integrity constraints to table B that ensures
> the values exist in tables
> A OR C ?
>
> This code below fails as 4,5,6 are in table B -
>
> ALTER TABLE b ADD CONSTRAINT A_FK
> FOREIGN KEY (ID)
> REFERENCES a (ID) ;
>
>
> Any ideas?
>
> thanks
>
> harry

The database cannot do it because your integrity is already broken. first you have to create a status which complies to the constraints you want to enforce.

Not to mention of course you reference has to be uniquely indexed.

Cheers,
Henning

-- 
Henning Follmann          |   H.Follmann_at_gmx.de
8 Jane Road               |  (+1)(908) 464 8972
New Providence, NJ 07974  |                 USA


-----=  Posted via Newsfeeds.Com, Uncensored Usenet News  =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
 Check out our new Unlimited Server. No Download or Time Limits!
-----==  Over 80,000 Newsgroups - 19 Different Servers!  ==-----
Received on Thu Nov 29 2001 - 16:15:57 CST

Original text of this message

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