Oracle中查询、禁用、启用、删除表外键
生活随笔
收集整理的這篇文章主要介紹了
Oracle中查询、禁用、启用、删除表外键
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1、查詢所有表的外鍵
select table_name, constraint_name from user_constraints where constraint_type = 'R';2、禁用所有外鍵約束, 使用下面的sql生成對應sql腳本:
select 'alter table ' || table_name || ' disable constraint ' || constraint_name || ';'from user_constraintswhere constraint_type = 'R';生成的sql類似下面的語句:
alter table HRMIS_RELIC_DAMAGE disable constraint FK_HRMIS_RE_0927;alter table HRMIS_RELIC_BASE disable constraint FK_HRMIS_RE_0922;3、啟用所有外鍵約束, 使用下面的sql生成對應sql腳本:
select 'alter table ' || table_name || ' enable constraint ' || constraint_name || ';'from user_constraintswhere constraint_type = 'R';生成的sql類似下面的語句:
select 'alter table ' || table_name || ' drop constraint ' || constraint_name || ';'from user_constraintswhere constraint_type = 'R';生成的sql類似下面的語句:
alter table HRMIS_RELIC_DAMAGE drop constraint FK_HRMIS_RE_0927;alter table HRMIS_RELIC_BASE drop constraint FK_HRMIS_RE_0922;?
?
--------------------- 本文來自 麥田 的CSDN 博客 ,全文地址請點擊:https://blog.csdn.net/itmyhome1990/article/details/48933839?utm_source=copy?
轉載于:https://www.cnblogs.com/jnba/p/10677694.html
總結
以上是生活随笔為你收集整理的Oracle中查询、禁用、启用、删除表外键的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Linux记录-salt命令
- 下一篇: A Convolutional Neur