Re: Repost - Constraint - Referencing

From: Martin Farber <farber_at_nynexst.com>
Date: 1995/12/09
Message-ID: <4ab0qv$3o9_at_news.nynexst.com>#1/1


Like the message says: no matching unique or primary key for this column-list

A Foreign Key, by definition, references the *entire* Primary Key of a table.

You only seem to reference the 1st column. That would not necessarily map to a single reference, thus it is disallowed.

I hope this helps.

Sincerely,

Martin Farber
Independent Oracle Consultant "A Jack of all trades and a slave to one."

                        |  NYNEX Science & Technology
                        |  500 Westchester Ave, Rm 1B-23
                        |  White Plains, NY  10604
                        |     -----------------
                        |  email: farber_at_nynexst.com
                        |  Voice: 914/644-2656
                        |    FAX: 914/644-2216

In article 433A_at_redbird.mtc.ti.com, Aftikhar Aslam <aftikhar_at_redbird.mtc.ti.com> () writes:
>Hi EveryBody,
>
>I'm experiencing some problems referencing a key from another table when
>placing a constraint on a column in another table. I have recreated the
>problem with some simple tables and the session is logged below.
>
>I will appreciate any help that explains why I am getting the error, I
>followed the note's in the Oracle guide - but according to them, this
>should work * hah *
>
>Thanks In Advance
>AA
>
>
>
>SQL> create table aa
> (alpha number(10),
> beta number(10),
> theta number(10))
> STORAGE (INITIAL 1M
> NEXT 500K
> MINEXTENTS 1
> MAXEXTENTS 10)
>PCTFREE 5
>PCTUSED 60
>tablespace temp;
>
>Table created.
>
>SQL> describe aa
> Name Null? Type
> ------------------------------- -------- ----
> ALPHA NUMBER(10)
> BETA NUMBER(10)
> THETA NUMBER(10)
>
>SQL> alter table aa add primary key(alpha,beta,theta);
>
>Table altered.
>
>SQL> create public synonym aa for aa;
> Synonym created.
>
>SQL> create table b
> ( gamma number(10) constraint gamma_fk references aa(alpha))
> STORAGE (INITIAL 1M
> NEXT 500K
> MINEXTENTS 1
> MAXEXTENTS 10)
>PCTFREE 5
>PCTUSED 60
>tablespace temp;
>( gamma number(10) constraint gamma_fk references aa(alpha))
> *
>ERROR at line 2:
>ORA-02270: no matching unique or primary key for this column-list
Received on Sat Dec 09 1995 - 00:00:00 CET

Original text of this message