Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem with Keys creation

kumar73Jul 19 2010 — edited Jul 19 2010
Hello Friends,

I am facing a typical sql statement errors ..

I am having a master table called ECOMMERCE having the primary keys as ( FAMID, SEQNO, ALCNO, ITEM )

and I want to create foreign key for the tables like EAPA , EAPB etc.

but the requirement is to have foreign key for only FAMID, SEQNO, ALCNO

I am getting the following error as ..

ERROR: ORACLE ERROR:ORA-02270: no matching unique or primary key for this column-list
ALTER TABLE P3I2009Q2_NAIR.EAPA ADD (CONSTRAINT fk_EAPA FOREIGN KEY
(FAMID,SEQNO,ALCNO) REFERENCES P
3I2009Q2_NAIR.ECOMMERCE(FAMID,SEQNO,ALCNO))

Please advice !!

heres the requirements:-
=================

one record in EAPA/ EAPB will have multiple records in ECOMMERCE ie one to many relationship

ECOMMERCE:-

FAMID - SEQNO - ALCNO - ITEM - COST
1234 1 1 VAR1 10
1234 1 1 VAR2 20
1234 1 1 VAR3 30

EAPA:

FAMID - SEQNO - ALCNO - ITEM1 ITEM2 ITEM3 - VALUE1 VALUE2 VALUE3
1234 1 1 VAR1 VAR2 VAR3 10 20 30

thats why we didn't made item as a key in ECOMMERCE table as it need to have multiple records for a single record in EAPA.

If this is the requirement how we should have keys assigned ? - iI mean how the primary and foreign key relations should be assiged .

appreciate your help in this regards.

thanks/kumar
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 16 2010
Added on Jul 19 2010
3 comments
593 views