加入一些外鍵約束到2臺輸出,監事時,我有一個問題:SQL錯誤:ORA-02270:沒有匹配的唯一或主鍵此列列表
ALTER TABLE OUTPUT ADD CONSTRAINT PROJECT_OUTPUT_FK
FOREIGN KEY (proj_id)
REFERENCES PROJECT (proj_id)
NOT DEFERRABLE;
ALTER TABLE SUPERVISOR ADD CONSTRAINT PROJECT_SUPERVISOR_FK
FOREIGN KEY (proj_id)
REFERENCES PROJECT (proj_id)
NOT DEFERRABLE;
錯誤顯示:
SQL Error: 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.
*Action: Find the correct column names using the ALL_CONS_COLUMNS
catalog view
在這種情況下該怎麼辦?
你對錯誤有什麼不瞭解?外鍵約束需要引用被引用表中的主鍵或唯一鍵。 –
PROJECT(proj_id)是主鍵嗎? – Praveen
http://stackoverflow.com/questions/10802212/oracle-ora-02270-no-matching-unique-or-primary-key-for-this-column-list-erro – DanK