Home » SQL & PL/SQL » SQL & PL/SQL » no matching unique or primary key for this column-list
no matching unique or primary key for this column-list [message #651] Tue, 26 February 2002 00:47 Go to next message
philarmo
Messages: 15
Registered: February 2002
Junior Member
hi, i create one table with :
create table s_dept
(id number(5)
CONSTRAINT s_dept_id_pk PRIMARY KEY,
name varchar2(30)
CONSTRAINT s_dept_name_nn NOT NULL,

region varchar2(30)
CONSTRAINT s_dept_region_nn NOT NULL,
CONSTRAINT s_dept_name_region_un UNIQUE
(name,region))

THEN, i want to create a table two with two columns filled by the first table
create table s_emp
(id number(7)
constraint s_emp_id_pk PRIMARY KEY,
surname varchar2(30)
constraint s_emp_surname_nn NOT NULL,
dep number(5)
constraint s_emp_dep_fk REFERENCES
s_dept (id),

region_id varchar2(30)
constraint s_emp_region_id_fk REFERENCES
s_dept (region),
Constraint s_emp_dep_region_id_un UNIQUE
(dep, region_id))

BUT I HAVE A MSG ERROR : ORA-02270: no matching unique or primary key for this column-list
Re: no matching unique or primary key for this column-list [message #652 is a reply to message #651] Tue, 26 February 2002 01:34 Go to previous messageGo to next message
pratap kumar tripathy
Messages: 660
Registered: January 2002
Senior Member
the table s_emp is tring to reference the s_dept (region) and there is no unique/primary key exist for region in s_dept table

-------------------------------------
ORA-02270 no matching unique or primary key for this column-list

Cause: An attempt was made to reference a unique or primary key in a table with a CREATE or ALTER TABLE statement when no such key exists in the referenced table.
Action: Add the unique or primary key to the table or find the correct names of the columns with the primary or unique key, and try again.

----------------------------------------
Re: no matching unique or primary key for this column-list [message #661 is a reply to message #652] Tue, 26 February 2002 03:14 Go to previous message
philarmo
Messages: 15
Registered: February 2002
Junior Member
i don t understand. In the first table, region is with unique
Previous Topic: How can I get the DDL of a table
Next Topic: Can't use CASE within a cursor in a package??
Goto Forum:
  


Current Time: Thu Apr 25 09:35:32 CDT 2024