oracle啟用 禁用 刪除外來鍵

2021-06-03 16:28:28 字數 554 閱讀 2790

禁用所有外來鍵約束

select 'alter table '||table_name||' disable constraint '||constraint_name||';' from user_constraints where constraint_type='r' 

--and status='enabled'

啟用所有外來鍵約束

select 'alter table '||table_name||' enable constraint '||constraint_name||';' from user_constraints where constraint_type='r' 

---and status='disabled'

刪除所有外來鍵約束

select 'alter table '||table_name||' drop constraint '||constraint_name||';' from user_constraints where constraint_type='r'

oracle 刪除外來鍵約束 禁用約束 啟用約束

執行以下sql生成的語句即可 刪除所有外來鍵約束 sql select alter table table name drop constraint constraint name from user constraints where constraint type r 禁用所有外來鍵約束 sql...

刪除外來鍵約束

主表 create table test1 id int primary key not null,value int insert test1 select 1,2 go 從表 create table test2 id int references test1 id value int go 第...

MySQL刪除外來鍵

1 刪除表中的外來鍵 語法 alter table tablename drop foreign key foreignkeyname 比如我要刪除account表中user id所引用的外來鍵 先輸入show create table account 檢視建表語言 返回如下資訊 可知外來鍵名為 f...