Oracle's specification or SQL's ? : Truncate table with foreign key constraints

狂风中的少年 提交于 2019-12-13 05:13:50

问题


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

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


回答1:


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.



来源:https://stackoverflow.com/questions/9519432/oracles-specification-or-sqls-truncate-table-with-foreign-key-constraints

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!