CREATE OR REPLACE PROCEDURE test(p_array_size IN PLS_INTEGER DEFAULT 10000)
IS
TYPE ARRAY IS TABLE OF a%ROWTYPE;
l_data ARRAY;
CURSOR c IS
SELECT *
FROM a;
BEGIN
OPEN c;
LOOP
FETCH c BULK COLLECT INTO l_data LIMIT p_array_size;
FORALL i IN 1..l_data.COUNT
INSERT INTO t VALUES l_data(i);
COMMIT;
EXIT WHEN c%NOTFOUND;
END LOOP;
CLOSE c;
END test;
/
IS
TYPE ARRAY IS TABLE OF a%ROWTYPE;
l_data ARRAY;
CURSOR c IS
SELECT *
FROM a;
BEGIN
OPEN c;
LOOP
FETCH c BULK COLLECT INTO l_data LIMIT p_array_size;
FORALL i IN 1..l_data.COUNT
INSERT INTO t VALUES l_data(i);
COMMIT;
EXIT WHEN c%NOTFOUND;
END LOOP;
CLOSE c;
END test;
/