在Oracle中删除所有强制性外键约束

时间:2014-10-27 12:59:23   收藏:0   阅读:263

--查询用户所有表的外键,owner条件为user
select * from user_constraints c where c.constraint_type = ‘R‘ and c.owner = ‘A‘;

--删除用户所有表的外键,owner条件为user

select ‘alter table ‘||t.table_name||‘ drop constraint ‘||t.constraint_name||‘;‘ from user_constraints t
where t.constraint_type=‘R‘ and c.owner = ‘A‘;

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!