Oracle删除数据报ORA 02292错误的巧妙解决方法
--查询表TP_MENU有哪些约束
select * from user_constraints u where u.constraint_name like '%TB_ROLE%';
--失效约束
alter table TP_MENU disable constraint FK_TP_MENU_REFERENCE_TP_MENU cascade;
alter table TB_ROLE_REF_MENU disable constraint FK_TB_ROLE__REFERENCE_TP_MENU cascade;
--删除数据
delete from tp_menu t where t.status = 0;
--生效约束
alter table TP_MENU enable constraint FK_TP_MENU_REFERENCE_TP_MENU;
alter table TB_ROLE_REF_MENU enable constraint FK_TB_ROLE__REFERENCE_TP_MENU;
--查看数据
select * from TP_MENU;
-------------示例
DELETE FROM apply_event WHERE applicant_idnumber='654121199309233463xxx';
删除提示:
ORA-02292: 违反完整约束条件 (EHRSS_BT_PERSON.PK_UNEMP_MONEY) - 已找到子记录
select * from user_constraints u where u.constraint_name like '%PK_UNEMP%';
SELECT * FROM APPLY_UNEMP_MONEYAPPLY;
SELECT * FROM APPLY_UNEMP_MONEYSTOP;
删除查询外键相关表数据,后删除要删除表的数据;