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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Creating Constraints question

Re: Creating Constraints question

From: Deana Strbevski <deana.strbevski_at_ina.hr>
Date: Tue, 07 Mar 2000 09:40:21 +0100
Message-ID: <38C4C075.50AEA5F4@ina.hr>


Yes, You have to match all columns of primary key.

argosy22_at_my-deja.com wrote:
>
> HI all,
>
> I'm trying to create a constraint.
>
> alter table RFQ_F
> add constraint FK_RFQFP
> foreign key (Rfq_P_Id )
> references RFQ_P_mar01 (Rfq_P_Id)
>
> - works fine.
>
> (drop the constraint here. )
>
> alter table RFQ_F
> add constraint FK_RFQFP
> foreign key (Rfq_P_Id )
> references RFQ_P (Rfq_P_Id)
> *
> ERROR at line 3:
> ORA-02270: no matching unique or primary key for this column-list
>
> The are few differences between RFQ_P_mar01 and RFQ_P.
> Each have exactly the same rows.
>
> The only differences between RFQ_P_mar01 and RFQ_P is that one
> more field is added:
>
> RFQ_P_ID NOT NULL NUMBER
> RFQ_ID NOT NULL NUMBER
> VERSION NOT NULL NUMBER <- new field
> added to RFQ_P
> ...
>
> and the primary keys are different:
>
> RFQ_P Indexes/PK:
>
> INDEX_NAME COLUMN_NAME COLUMN_POSITION
> ------------------------------ -------------------- ---------------
> PK_RFQ_P RFQ_P_ID 1
> RFQ_ID 2
> VERSION 3
>
> RFQ_P_mar01 Indexes/PK:
>
> INDEX_NAME COLUMN_NAME COLUMN_POSITION
> ------------------------------ -------------------- ---------------
> PK_RFQP_ID RFQ_P_ID 1
>
> So, the question is:
>
> If I make a constraint where one table references the other,
> must it reference the entire primary key, or not?
>
> Or is is something else?
>
> Thanks,
>
> Argosy
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Tue Mar 07 2000 - 02:40:21 CST

Original text of this message

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