Error SQL: ORA-02270: no matching unique or primary key for this column-list [message #662819] |
Fri, 12 May 2017 09:44 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/35b2822d6bb32d97ef426753c57218bb?s=64&d=mm&r=g) |
Cirov
Messages: 13 Registered: May 2017
|
Junior Member |
|
|
Hi, i'm getting the error in the subject while trying to create the table with a foreign key constraint:
CREATE TABLE Has (
modelName VARCHAR2(40 CHAR),
manufaturerName VARCHAR2(30 CHAR),
accessoryCode VARCHAR2(15 CHAR),
CONSTRAINT FK_modelName FOREIGN KEY (modelName) REFERENCES MODEL(MODELNAME)
);
The primary key exists in the table MODEL:
SELECT * FROM ALL_CONS_COLUMNS
WHERE TABLE_NAME = 'MODEL';
P17 FK_MANUFACTURER MODEL MANUFACTURERNAME 1
P17 PK_MODEL MODEL MANUFACTURERNAME 2
P17 PK_MODEL MODEL MODELNAME 1
I've created tables with foreign keys before, I'm doing something wrong this time but I can't see what would be the problem.
|
|
|
|
|
|