删除具有外键约束的行

编程入门 行业动态 更新时间:2024-10-24 20:16:14
本文介绍了删除具有外键约束的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在处理一项要求.

I am working on a requirement.

有一个表.我想从该表中删除一行,但是我不能删除它,因为

There is one table.I want to delete a row from this table but i cannot delete it because

1.该表由79表通过外键关系引用 2.这79个表中的每个表都由其他100个表

1.This table is referred by 79 table through foreign key relationship 2.Each of those 79 tables are referred by other 100's of table

所以您可以想象它的树状结构.因此,我需要从底部开始并到达TOP.我需要通过SQL来完成

so you can imagine its kind of tree structure.So i need to start from bottom and reach to TOP.I need to do it through SQL

所以我应该从哪里开始???我需要创建一个临时表或任何我可以做的有用的方法吗?

So from where I should start ???Do i need to create a temp table or anything which i can do any approach which can be useful???

注意:不允许删除CASCADE

Note:CASCADE DELETE NOT ALLOWED

我可能无权访问任何sys表.任何方便的方法???我正在使用oracle 10g

I might not have access to any sys tables.. any approach that can be handy??? I am using oracle 10g

推荐答案

请参阅: http: //www.techonthenet/oracle/foreign_keys/disable.php

ALTER TABLE table_name disable CONSTRAINT constraint_name;

只需确保了解执行此过程的后果以及它将对其他数据/应用程序功能产生的影响.

Just be sure to understand the consequences of doing such a procedure and the effects it will have on other data / application functions.

此外,如果不太明显,请确保随后启用约束

Also, if it wasn't obvious be sure to enable the constraint afterwards

ALTER TABLE table_name enable CONSTRAINT constraint_name;

更多推荐

删除具有外键约束的行

本文发布于:2023-10-14 21:49:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1492312.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!