Creating Constraints question

From: <argosy22_at_my-deja.com>
Date: Mon, 06 Mar 2000 23:23:34 GMT
Message-ID: <8a1elg$hgt$1_at_nnrp1.deja.com>


[Quoted] HI all,

[Quoted] 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:

[Quoted] 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 - 00:23:34 CET

Original text of this message