It is too slow to update the data with a cursor, and after a series of queries in the same table is deleted, the insertions are likely to be overloaded, so it is important to process the data in batches, and here are some of the functional operations of a small number of stored procedures that I write in the project. The main implementation is to add the number of similar data and reinsert the data, remove the rest of the duplication of data, nonsense, the code
Begin
--v_step: = 5;
INSERT INTO T_bu_future_order_ei_tmp
(Factory_code,
Ei_code,
Car_type_code,
Produce_date,
Capacity,
MODIFIER)
Select Factory_code,
Ei_code,
Car_type_code,
Produce_date,
SUM (t.capacity),
' Sum '
From T_bu_future_order_ei_tmp T
where 1 = 1
Group by Factory_code, Ei_code, Car_type_code, produce_date;
End
Begin
Delete T_bu_future_order_ei_tmp T
where t.modifier! = ' Sum ';
End
About Oracle Batch processing data