Tried below code to copy records from one table to another table, first table is process_state, second table is process_state_archive
CREATE OR REPLACE PROCEDURE fast_proc (p_array_size IN PLS_INTEGER DEFAULT 100)
IS
TYPE ARRAY IS TABLE OF process_state%ROWTYPE;
l_data ARRAY;
CURSOR c IS SELECT * FROM process_state;
BEGIN
OPEN c;
LOOP
FETCH c BULK COLLECT INTO l_data LIMIT p_array_size;
FORALL i IN 1..l_data.COUNT
INSERT INTO process_state_archive VALUES l_data(i);
commit;
EXIT WHEN c%NOTFOUND;
END LOOP;
CLOSE c;
END fast_proc;
Executed successfully but no records are there in second table.
Can any one tell me what is wrong with the above procedure?