本文介绍了对于DELETE RESTRICT错误的FOREIGN KEY - Oracle的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 最近我一直试图在表中添加下面的外键,使用下面的命令在Oracle中使用RESTRICT子句: ALTER TABLE Employee_SalHead ADD CONSTRAINT PAYROLL_SHEAD_FKEY FOREIGN KEY ( SalHead_ID )参考SalHead ( SalHead_ID ) ON DELETE RESTRICT ENABLE; 这给了我以下错误: Lately I have been trying to add the following foreign key in the table, with the RESTRICT Clause in Oracle with the following command.:ALTER TABLEEmployee_SalHeadADD CONSTRAINT PAYROLL_SHEAD_FKEY FOREIGN KEY( SalHead_ID)REFERENCES SalHead( SalHead_ID)ON DELETE RESTRICT ENABLE;This gave me the following error:Also if I try the same through Oracle SQL developer, I get only the options Set Null, Cascade and No Action Only. 解决方案 Oracle only supports ON DELETE SET NULL and ON DELETE CASCADE. You can achieve your requirement by simply doing the below query. No need to mention ON DELETE RESTRICTALTER TABLE Employee_SalHead ADD CONSTRAINT PAYROLL_SHEAD_FKEY FOREIGN KEY(SalHead_ID) REFERENCES SalHead(SalHead_ID);ON DELETE NO ACTION is Default.From Documentation 这篇关于对于DELETE RESTRICT错误的FOREIGN KEY - Oracle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 09-03 06:13