无法将主键字段移动到外键中?

时间:2021-05-13 10:18:24

I've created to two tables name STUDENT and ROOM which in my case is a one to one relation. The primary key from STUDENT table is a foreign key in ROOM but when i insert data into student its doesn't update values in foreign key of room.

There were many similar question about this in mysql and sqlserver but not in oracle sql.

我创建了两个名为STUDENT和ROOM的表,在我的例子中是一对一的关系。 STUDENT表中的主键是ROOM中的外键,但是当我向学生插入数据时,它不会更新房间外键中的值。在mysql和sqlserver中有很多类似的问题,但在oracle sql中却没有。

1 个解决方案

#1


0  

I believe you are looking for cascading updates. Check out this article:- http://tkyte.blogspot.com/2009/10/httpasktomoraclecomtkyteupdatecascade.html?m=1 The script from article generates a package and three triggers which will do cascade updates.

我相信你正在寻找级联更新。看看这篇文章: - http://tkyte.blogspot.com/2009/10/httpasktomoraclecomtkyteupdatecascade.html?m=1文章中的脚本生成一个包和三个触发器,它们将进行级联更新。

#1


0  

I believe you are looking for cascading updates. Check out this article:- http://tkyte.blogspot.com/2009/10/httpasktomoraclecomtkyteupdatecascade.html?m=1 The script from article generates a package and three triggers which will do cascade updates.

我相信你正在寻找级联更新。看看这篇文章: - http://tkyte.blogspot.com/2009/10/httpasktomoraclecomtkyteupdatecascade.html?m=1文章中的脚本生成一个包和三个触发器,它们将进行级联更新。