[英]Foreign key on two columns referencing one pk in another table on Oracle
Is there a way to create a foreign key on two columns that reference the same PK in another table? 有没有办法在引用另一个表中相同PK的两列上创建外键?
Both of these columns are related to the PK. 这两个列都与PK相关。
Here is what I have: 这是我所拥有的:
CONSTRAINT some_FK FOREIGN KEY (col1, col2) REFERENCES table(col_PK);
But I keep getting the following error: 但是我一直收到以下错误:
ORA-02256: number of referencing columns must match referenced columns
ORA-02256:引用列数必须与引用列匹配
You want two different foreign keys: 您需要两个不同的外键:
CONSTRAINT old_player_fk FOREIGN KEY (old_player_id) REFERENCES player(id),
CONSTRAINT new_player_fk FOREIGN KEY (new_player_id) REFERENCES player(id)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.