CURSOR..... FETCH ....BULK COLLECT ..LIMIT; ORA-01461
34268May 20 2007 — edited May 22 2007I'm user CURSOR with FETCH..BULK COLLECT .. LIMIT option to copy records from one table to other. Target table is just a replica of source table, no difference in coloumn/datatype. All fields are number type or varchar2, no LONG type field. Source table has 2 million records. My code is breaking with "ORA-01461: can bind a LONG value only for insert into a LONG column" exception, after successful insertion of 13000 records. Same code is working properly on other box.
Oracle version : Release 9.2.0.1.0 - Production on Sun.
CREATE OR REPLACE PROCEDURE RPT_FIN_MEM_CURRENT_test(i_bulk_size IN PLS_INTEGER DEFAULT 1000)
IS
TYPE ARRAY IS TABLE OF rpt_mem_current_test%ROWTYPE;
v_data_bulk ARRAY;
CURSOR mem_cur IS
SELECT
*
FROM
MEM_CURRENT;
BEGIN
EXECUTE IMMEDIATE 'TRUNCATE TABLE RPT_MEM_CURRENT_TEST';
OPEN mem_cur;
LOOP
FETCH mem_cur BULK COLLECT INTO v_data_bulk LIMIT 1000;
DBMS_OUTPUT.PUT_LINE('Iteration ');
FORALL i IN 1..v_data_bulk.COUNT
INSERT INTO rpt_mem_current_test VALUES v_data_bulk(i);
COMMIT;
EXIT WHEN mem_cur%NOTFOUND;
END LOOP;
CLOSE mem_cur;
END RPT_FIN_MEM_CURRENT_TEST;
/
Any thought??