您的位置:首页 > 博客中心 > 数据库 >

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

时间:2022-03-14 01:36

--查询用户所有表的外键,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‘;

热门排行

今日推荐

热门手游