Contents
How to fix ora 02270 no matching unique or primary key for this column list?
This error commonly occurs when you try to create a foreign key that references a table that doesn’t have a primary key. To resolve this problem, create a primary key on the referenced table. Then re-execute your command to create the foreign key.
What does no matching unique or primary key for this column list?
Conclusion: A foreign key must always refer to a column or columns declared as either PRIMARY KEY or UNIQUE in Oracle. Fullname etc. are not declared as unique in the parent table, and therefore you can’t reference them from the child table.
How do you set a composite primary key as a foreign key?
A referential constraint must have a one-to-one relationship between referencing and referenced columns. In other words, if the primary key is a set of columns (a composite key), then the foreign key also must be a set of columns that corresponds to the composite key.
Why is there no matching or primary key for this column list?
ORA-02270: no matching unique or primary key for this column-list 02270. 00000 – “no matching unique or primary key for this column-list” *Cause: A REFERENCES clause in a CREATE/ALTER TABLE statement gives a column-list for which there is no matching unique or primary key constraint in the referenced table.
Why do I get an ora-02270 error in Oracle?
Learn the cause and how to resolve the ORA-02270 error message in Oracle. When you encounter an ORA-02270 error, the following error message will appear: You tried to reference a table using a unique or primary key, but the columns that you listed did not match the primary key, or a primary key does not exist for this table.
Why did the statement ” no matching primary key ” fail?
That statement failed because USER is a reserved keyword so we cannot name a table USER. Let’s fix that:
Why is EMP _ ID not a unique key?
The problem is that EMP_ID (by itself) isn’t a primary or unique key of table Employees, instead, you have a compound primary key (EMP_ID, EXPERT_ID). To fix the issue either make EMP_ID the primary key of the Employees table (which seems intuitive as each employee ought to have a unique id) or add a separate unique constraint on EMP_ID.