Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: foreign keys on multiple columns
You need to do more than just create a unique index. You need to create a =
PRIMARY or UNIQUE constraint as well.
>>> teich_at_novedia.de 09/11/00 11:03AM >>> Hi all,
i have some trouble with Oracle 8i (8.1.6) running on NT 4.0. I used the
following script to create three tables with some unique indixes and two
foreign keys. Everything goes right, until the creation of the foreign =
key,
then i get : ORA-02270: no matching unique or primary key for this
column-list.
Does anybody have "any" idea, whats going wrong ??
TIA
/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
/* Database name: MODL_1 */ /* DBMS name: ORACLE Version 8i */ /* Created on: 9/11/00 1:31:27 PM *//*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
/* Table : fahrzeit *//*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
create table fahrzeit (
id number(10) not null, id_log number(10) not null, id_spl number(10) not null, name char(10),
/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
/* Index: unq_fahrzeit *//*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
id_spl asc,
id_log asc
)
/
/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
/* Table : zug *//*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
create table zug (
id number(10) not null, id_log number(10) not null, id_spl number(10) not null, name char(10),
/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
/* Index: unq_zug *//*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
id_spl asc,
id_log asc
)
/
/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
/* Table : fahrzeit2zug *//*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
create table fahrzeit2zug (
id number(10) not null, id_log number(10), id_spl number(10) not null, id_zug number(10), id_zug_log number(10) not null, id_fahrzeit number(10), id_fahrzeit_log number(10) not null, constraint pk_fahrzeit2zug primary key (id),constraint fk_key_5_fahrzeit unique (id_spl, id_zug_log), constraint ak_ak_key_6_fahrzeit_fahrzeit unique (id_spl, id_fahrzeit_log),
constraint fk_fahrzeit_reference_zug foreign key (id_spl, id_zug_log) references zug (id_spl, id_log), constraint fk_fahrzeit_reference_fahrzeit foreign key (id_spl, id_fahrzeit_log) references fahrzeit (id_spl, id_log))
Novedia AG, Andreas Teich, Dipl.-Math.
Hardenbergstrasse 19 tel:+49.30.311889-55 fax:+49.30.311889-19 D-10623 Berlin, Germany mailto:teich@novedia.de http://novedia.de=/=20
--=20
Author: Andreas Teich
INET: teich_at_novedia.de=20
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists --------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may Received on Mon Sep 11 2000 - 13:34:18 CDT
![]() |
![]() |