I have 5 million rows that are to be read from Java and using pl/sql , I have to insert into Oracle. This is what I have written.
It stops working at the limit value. How should this be re written , or modified.

Pls give an example. The values have to be read by java and written to Oracle.

CREATE OR REPLACE PROCEDURE pass_ref_cur(p_cursor SYS_REFCURSOR) IS
type emp_rec_type is record ( empid number (5), empname varchar2 (30));
TYPE array_t IS TABLE OF emp_rec_type INDEX BY BINARY_INTEGER;
rec_array array_t;
BEGIN
FETCH p_cursor BULK COLLECT INTO rec_array;
FOR i IN rec_array.FIRST .. rec_array.LAST
LOOP
dbms_output.put_line(rec_array(i).empid);
dbms_output.put_line(rec_array(i).empname);
END LOOP;
END pass_ref_cur;
/


set serveroutput on

DECLARE
rec_array SYS_REFCURSOR;
BEGIN
OPEN rec_array FOR
'SELECT empid, empname FROM employees';
pass_ref_cur(rec_array);
CLOSE rec_array;
END;