CREATE TYPE o_A AS OBJECT (A1 VARCHAR2 (4000));
CREATE OR REPLACE TYPE t_A IS TABLE OF o_A;
CREATE TABLE table_o_A
(
oA_id INTEGER GENERATED BY DEFAULT AS IDENTITY,
oA o_A,
PRIMARY KEY (oA_id)
);
I would to add the lines of a t_A in the table_oA.
CREATE PROCEDURE aa (query_result t_A)
is
v_i INTEGER;
begin
SELECT MAX (oA_id)
INTO v_i
FROM table_o_A;
FORALL i IN INDICES OF query_result
INSERT INTO table_o_A(
oA_id,
oA)
VALUES ( v_i+i, query_result (i));
end;
[Error] Compilation (887: 26): PLS-00430: FORALL iteration variable I is not allowed in this context
I thinks it doesn't work because i isn't an integer. I could use a for loop and use a real integer but it make a switch between the pl/sql and sql context. How do I do that with the ForAll loop?