如何使用“ON UPDATE CASCADE"创建外键在甲骨文上? [英] How to create a Foreign Key with "ON UPDATE CASCADE" on Oracle?

查看:27
本文介绍了如何使用“ON UPDATE CASCADE"创建外键在甲骨文上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 MS SQL Server 中,可以使用 ON UPDATE CASCADE 选项创建外键,因此每当您更新主键中的一列时,其他表中的外键也将是由 DBMS 更新.

In MS SQL Server it is possible to create a foreign key with ON UPDATE CASCADE option, so whenever you update one of the columns in the primary key, the foreign keys in other tables will also be update by the DBMS.

那么,如何在 Oracle 中做到这一点?

So, how to do it in Oracle?

推荐答案

Oracle 不允许使用ON UPDATE CASCADE"的外键约束.

Oracle does not allow a Foreign Key constraint with "ON UPDATE CASCADE".

这里有几个选项.

创建外键,并创建更新时"触发器.使用下面的包(需要安装在数据库中).

Create the Foreign Key, and create an "On Update" trigger. Make use of the package below (needs to be installed in the db).

http://tkyte.blogspot.com/2009/10/httpasktomoraclecomtkyteupdatecascade.html

如果您有其他问题或需要更多信息,请告诉我.

Let me know if you have additional questions or need more information.

这篇关于如何使用“ON UPDATE CASCADE"创建外键在甲骨文上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆