ORA-02292: integrity constraint violated - child record found

详细原因

删除 / 更新主表主键,子表存在关联外键数据,外键约束阻止删除,防止数据孤儿。

完整排查 & 解决

方案 1:先删除子表关联数据,再删主表
sql
delete from child_table where parent_id=100;
delete from parent_table where id=100;
方案 2:建表时开启级联删除(一劳永逸)
sql
constraint fk_child foreign key(parent_id) references parent(id) on delete cascade
上一篇 【转载】HCIE R&S 备考笔记 NAT技术基础与配置(华为设备)
下一篇 虚拟机安装iKuai