I am working in Oracle version > 10gR2. I have a table with 20 million records. I want to process all records before exporting them to file, but performance of this is very slow.
Do you have any advice? Below is my code:
declare
l_temp_detail clob := null;
icount number:=0;
cursor c_test is
select /*+ PARALLEL(12) */ *
from test_table t;
TYPE t_test IS TABLE OF test_table%ROWTYPE INDEX BY PLS_INTEGER;
l_test_items t_test;
BEGIN
l_temp_detail := '';
OPEN c_test;
LOOP
FETCH c_test
BULK COLLECT INTO l_test_items LIMIT 25000;
EXIT WHEN l_test_items.COUNT = 0;
FOR i in l_test_items.first .. l_test_items.last LOOP
icount := icount+1;
--doing business here
l_temp_detail := ....
END LOOP;
dbms_output.put_line(to_char(icount));
END LOOP;
CLOSE c_test;
END;