How to create a Foreign Key with “ON UPDATE CASCADE” on Oracle?

后端 未结 2 1746
予麋鹿
予麋鹿 2020-12-04 01:38

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 key

相关标签:
2条回答
  • 2020-12-04 02:08

    Would a database trigger do the job for you ?

    Here is the Oracle doc on the subject of Data Integrity for 11g (just incase you were interested).

    0 讨论(0)
  • 2020-12-04 02:29

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

    Here are a couple of options you have.

    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.

    0 讨论(0)
提交回复
热议问题