1. 程式人生 > >ORA-02292:integrity constraint(xx) violated - child record found 外來鍵關聯,無法刪除記錄

ORA-02292:integrity constraint(xx) violated - child record found 外來鍵關聯,無法刪除記錄

當我們刪除 有外來鍵的資料的時候 oracle 都會提示:ORA-02292:integrity constraint(xx) violated - child record found 

第一步:讓主鍵失效:alter table table_name disable primary key cascade;

第二步:刪除資料:delete from  table_name  where id = 'xx';

第三步:讓主鍵生效:alter table table_name enable primary key;