1. 程式人生 > >oracle 中禁用所有外來鍵關聯

oracle 中禁用所有外來鍵關聯

禁用外來鍵

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

啟用外來鍵

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