Hi Tom,
I have a scenario in which I need to pass the table name as input variable and create a table type based on that table and insert the data into
input table using bulk collect dynamically.I have tried creating the table type and insertion as below:
DECLARE
TYPE tabtype IS TABLE OF pTableName%ROWTYPE
INDEX BY PLS_INTEGER;
TYPE numtype IS TABLE OF NUMBER
INDEX BY PLS_INTEGER;
raRec tabtype;
BEGIN
FORALL i IN raTab.FIRST .. raTab.LAST-- SAVE EXCEPTIONS
EXECUTE IMMEDIATE 'INSERT INTO ' || pTableName ||
' VALUES ' || raTab (i);
EXCEPTION
WHEN OTHERS
THEN
NULL;
END;
But its throwing error when compiled in a procedure.
Thanks in advance.