凸轮以下可以顺利完成吗?只要将记录插入目标表,您就可以从源表中删除该记录。显然,这条记录在循环内的内存中,你能看到任何问题吗?或者可以用不同的方式完成。
我知道你们所有人都会说只需使用 APPEND 进行直接 SQL 插入,然后截断源表。
我只是好奇地把问题抛在那里。
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;