Oracle的规范还是SQL的? :截断具有外键约束的表 [英] Oracle's specification or SQL's ? : Truncate table with foreign key constraints

查看:87
本文介绍了Oracle的规范还是SQL的? :截断具有外键约束的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想看到有关具有外键约束的截断表"的规范,如下所示.有人知道它的定义位置吗?

I want to see a specification about "Truncate table with foreign key constraints" like below. Does anyone know where it is defined ?

在不利的一面,如果您有一个外键约束引用 您要截断的表,这将不起作用-即使 引用表中没有数据!这是因为外键 检查是使用DDL而不是DML完成的.这可以通过解决 临时禁用表的外键约束. http://www.orafaq.com/faq/difference_between_truncate_delete_and_drop_commands

On the minus side, if you have a foreign key constraint referring to the table you are trying to truncate, this won't work - even if the referring table has no data in it! This is because the foreign key checking is done with DDL rather than DML. This can be got around by temporarily disabling the foreign key constraint(s) to the table. http://www.orafaq.com/faq/difference_between_truncate_delete_and_drop_commands

推荐答案

您的意思是

You mean the fourth bullet in the restrictions on truncating tables section of the Oracle's truncate documentation?

您不能截断已启用外键的父表 约束.您必须先禁用约束,然后再截断 桌子.唯一的例外是,如果 完整性约束是自我参照的.

You cannot truncate the parent table of an enabled foreign key constraint. You must disable the constraint before truncating the table. An exception is that you can truncate the table if the integrity constraint is self-referential.

这篇关于Oracle的规范还是SQL的? :截断具有外键约束的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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