Oracle composite primary key / foreign key question

后端 未结 4 1692
余生分开走
余生分开走 2021-02-13 22:37

I have a composite primary key in 1 table in oracle. I want to create a foreign key for one table entry in my second table that references the composite primary key in the firs

4条回答
  •  隐瞒了意图╮
    2021-02-13 23:06

    You can't use:

    CONSTRAINT fk_persongroup FOREIGN KEY(groupid) REFERENCES groupspersonx(personid, groupid)
    

    Change that too:

    CONSTRAINT fk_persongroup FOREIGN KEY(groupid) REFERENCES groupspersonx(groupid) 
    

    That should work.

提交回复
热议问题