Cam the below be done without issues? Where as soon as you insert a record into the destination table you can then delete that record from the source table. Obviously this record is in memory within the loop, can you see any problems with this or can it be done in a different way.
I know all of you will say just do a direct SQL insert with APPEND and then truncate the source table.
I'm just throwing the question out there as I'm curious.
PROCEDURE copy_records_back IS
TYPE t_act_plus_triggers_copy1 IS TABLE OF act_plus_triggers_copy1%ROWTYPE; v_act_plus_triggers_copy1 t_act_plus_triggers_copy1;
CURSOR c_act_plus_triggers_copy1 IS SELECT * FROM act_plus_triggers_copy;
BEGIN
EXECUTE IMMEDIATE 'TRUNCATE TABLE act_plus_triggers1';
OPEN c_act_plus_triggers_copy1; LOOP
FETCH c_act_plus_triggers_copy1 BULK COLLECT INTO v_act_plus_triggers_copy LIMIT 10000;
FORALL i IN 1..v_act_plus_triggers_copy.COUNT
INSERT /*+ APPEND_VALUES */ INTO act_plus_triggers1 values v_act_plus_triggers_copy(i);
FORALL i IN 1..v_act_plus_triggers_copy.COUNT
DELETE FROM act_plus_triggers_copy
where surr_id = v_act_plus_triggers_copy(i).surr_id
COMMIT;
EXIT WHEN c_act_plus_triggers_copy1%NOTFOUND;
END LOOP;
CLOSE c_act_plus_triggers_copy1;
END copy_records_back;