The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.
procedure DEL_SHIPMENTS_CUSTOMER(cust_id_in number) is cnt NUMBER; begin cnt := 0; for rec in ( select sc.shipment_id from SHIPMENT_CUSTOMER sc inner join CUSTOMER_MOT mt on mt.customer_mot_id = sc.customer_mot_id where mt.customer_id = cust_id_in ) loop delete from SHIPMENT sh where sh.shipment_id = rec.shipment_id; cnt := cnt + 1; if (cnt = 1000) THEN commit; cnt := 0; end if; end loop; commit; end; procedure DEL_CUSTOMER(cust_id_in number) is begin UPDATE CUSTOMER cu SET MARK_FOR_DELETION = 'P' WHERE cu.customer_id = cust_id_in; commit; DEL_SHIPMENTS_CUSTOMER(cust_id_in); DELETE FROM RULE WHERE CUSTOMER_ID = cust_id_in; DELETE FROM MOT_RULE WHERE CUSTOMER_ID = cust_id_in; DELETE FROM ACCOUNT WHERE CUSTOMER_ID = cust_id_in; DELETE FROM CUSTOMER_STATION WHERE CUSTOMER_ID = cust_id_in; DELETE FROM CUSTOMER WHERE CUSTOMER_ID = cust_id_in; commit; end; begin -- Initialization null; end MAINTAIN_CUSTOMER;
Error at line 3 ORA-02292: integrity constraint (XM.C_REPORT_LINKS_REPORT_ID_FK) violated - child record found ORA-06512: at "XM.MAINTAIN_CUSTOMER", line 34 ORA-06512: at line 5
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.