天天看點

Oracle中删除外鍵限制、禁用限制、啟用限制

執行以下sql可以生成禁止、啟用、删除限制腳本,然後執行即可:

禁用所有外鍵限制

[sql]  view plain copy

  1. select 'alter table '||table_name||' disable constraint '||constraint_name||';' from user_constraints where constraint_type='R';  

啟用所有外鍵限制 [sql]  view plain copy

  1. select 'alter table '||table_name||' enable constraint '||constraint_name||';' from user_constraints where constraint_type='R';  

删除所有外鍵限制  [sql]  view plain copy

  1. select 'alter table '||table_name||' drop constraint '||constraint_name||';' from user_constraints where constraint_type='R';