Oracle 删除,禁用,启用表所有约束

执行以下sql生成的语句即可

1

删除所有外键约束 

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

2

禁用所有外键约束

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

3

启用所有外键约束

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

猜你喜欢

转载自anny627.iteye.com/blog/2180112