I am really unable to figure out why I am unable to make the below code work.
I tried to replicate the scenario explained in the below answer
Trying to use a FORALL to insert data dynamically to a table specified to the procedure
CREATE TABLE VISION.TEMP_TEST_TABLE
(
A NUMBER(10),
B NUMBER(10)
)
CREATE OR REPLACE PROCEDURE VISION.PR_TEST_FORALL AUTHID CURRENT_USER Is
v_SQL1 varchar2(1000) := 'select rownum, rownum from dual connect by rownum <= 11000';
v_SQL varchar2(1000) := 'INSERT /*+ APPEND */ INTO TEMP_TEST_TABLE VALUES :1';
TYPE generic_Looper_CurType IS REF CURSOR;
generic_Looper_Cursor generic_Looper_CurType;
TYPE TEST_FS_ARRAY_TYPE IS TABLE OF VISION.TEMP_TEST_TABLE%ROWTYPE INDEX BY BINARY_INTEGER;
TEST_FS_ARRAY_OBJ TEST_FS_ARRAY_TYPE;
FETCH_SIZE NUMBER := 10000;
BEGIN
open generic_Looper_Cursor for v_SQL1;
loop
FETCH generic_Looper_Cursor BULK COLLECT
INTO TEST_FS_ARRAY_OBJ LIMIT fetch_size;
execute immediate
'insert into TEMP_TEST_TABLE select * from table(:TEST_FS_ARRAY_OBJ)'
using TEST_FS_ARRAY_OBJ;
commit;
COMMIT;
EXIT WHEN generic_Looper_Cursor%NOTFOUND;
END LOOP;
End;
/
[Warning] ORA-24344: success with compilation error
23/11 PLS-00457: expressions have to be of SQL types
21/5 PL/SQL: Statement ignored
(2: 0): Warning: compiled but with compilation errors