oracle删除表数据时,提示违反唯一约束条件,已找到子记录,解决办法

这个问题是因为你删除这个表是主表,他的主键关联着其他表的外键,必须先删除字表的数据,才可以删除主表。

select a.constraint_name, a.table_name, b.constraint_name
from user_constraints a, user_constraints b
where a.constraint_type = 'R'
and b.constraint_type = 'P'
and a.r_constraint_name = b.constraint_name
and a.constraint_name = 'FK_XXXXX'

用这个语句可以找到子表。

tip:删除表数据时,提示触发器执行过程出错,可以把触发器禁止,之后再删除。

猜你喜欢

转载自www.cnblogs.com/lovejingjing/p/11115711.html