Hello,
I have a table with an expensive check in its
after insert statement trigger. Therefore I'd like to do inserts as bulk rather than individual inserts.
I've collected the values to insert in a varray but I don't know how to create a bulk insert statement with it.
This is my failing aproach:
CREATE OR REPLACE TYPE my_collection IS VARRAY (256) OF NUMBER;
CREATE TABLE test_bulk
(
test_id NUMBER
, id_test_1 NUMBER
, id_test_2 NUMBER
);
DECLARE
my_collection_test my_collection;
v_count NUMBER;
BEGIN
SELECT LEVEL
BULK COLLECT INTO my_collection_test
FROM DUAL
CONNECT BY LEVEL < 15;
v_count := my_collection_test.LAST;
INSERT INTO test_bulk (id_test_1, id_test_2)
SELECT 1, my_collection_test(rownum)
FROM dual CONNECT BY LEVEL < v_count;
END;
DROP TABLE test_bulk;
DROP TYPE my_collection;
What I get is a ORA-06532: Subscript outside of limit, ORA-06512: at line 10
How do I do this correctly?
bye
TPD