Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PO7 Foreign Key???
Hi,
BARBARA MOORE wrote:
>
> I'm a PO7 newbie and I'm trying to set up some foreign keys. I'm
> getting "ORA-02270: no matching unique or primary key for this
> column-list" if I don't have the corresponding primary key column in the
> foreign table flagged as "unique." I'm using multiple columns as
> primary keys so I can't have them set as unique. I know the foreign
Primary keys have (by definition) to be unique: "a primary key is a rule defined on a column (or set of columns) so that each row in the table can be uniquely identified by the values in the columns (or set of columns)". This means that, if you want to specify a primary key on a table, you will have to identify a set of columns whose content is unique in the complete table.
Foreign keys are the values you specify in a second table which refer to the primary keys of the first table. So if you wanted to link your two tables via foreign keys, these too will have to be a set of columns (in fact the EXACT copy of the referred primary keys).
Hope this helps,
-- Greets, Alain Schartz. To contact me, write to: schartz_at_mail.com ====================================================================================== Weinberg's Second Law: If builders built buildings the way programmers wrote programs, the first woodpecker to come along would destroy civilization. ====================================================================================== PGP Key Fingerprint: C052 418D 4A0D 2851 83A4 1765 3EF0 66BDReceived on Wed Dec 31 1997 - 00:00:00 CST