oracle 查看当前用户所有表之间的主外键关系和约束,删除约束
user_constraints:包括约束的所有信息;
user_cons_columns:约束视图的细视图;
set pages 50000
set feedback off
spool constraint.log
col parent format a27
col child format a27
col key format a21
select a.table_name Parent,
b.table_name Child,
column_name Key,
substr(position,1,1) P
from
user_constraints a, user_constraints b, user_cons_columns c
where
a.constraint_name = b.r_constraint_name
and a.constraint_name = c.constraint_name
order by 1, 2, 4;
spool off
//////////////////////////////////////////////////////////////////////
删除约束:
alter table 表名 drop constraint 约束名;
约束名可以从select constraint_name from user_constraints;