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 -> Creating Constraints question

Creating Constraints question

From: <argosy22_at_my-deja.com>
Date: 2000/03/06
Message-ID: <8a1elg$hgt$1@nnrp1.deja.com>#1/1

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)

(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 Mon Mar 06 2000 - 00:00:00 CST

Original text of this message

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