Documentation:
index_iterator_choice ::=
iterator ::=
(iteration_ctl_seq/iteration_control) pairs_of_control ::=
PAIRS does not work (21.3) with sql_statement:
declare
type tt is table of number index by varchar2(10 char);
t tt;
begin
t := tt(for c in (select 'one' k, 100 v from dual union all select 'two', 200 from dual) index c.k => c.v);
for k, v in pairs of t loop
dbms_output.put_line(k||'='||v);
end loop;
end;
/
one=100
two=200
declare
type tt is table of number index by varchar2(10 char);
t tt;
begin
t := tt(for k, v in pairs of (select 'one' k, 100 v from dual union all select 'two', 200 from dual) index k => v);
for k, v in pairs of t loop
dbms_output.put_line(k||'='||v);
end loop;
end;
/
ORA-06550: line 5, column 8:
PLS-00306: wrong number or types of arguments in call to 'TT'
ORA-06550: line 5, column 3:
PL/SQL: Statement ignored
declare
type tt is table of number index by varchar2(10 char);
t tt;
begin
t := tt(for k varchar2(10 char), v number in pairs of (select 'one' k, 100 v from dual union all select 'two', 200 from dual) index k => v);
for k, v in pairs of t loop
dbms_output.put_line(k||'='||v);
end loop;
end;
/
ORA-06550: line 5, column 48:
PLS-00862: The type of the iterand is not compatible with an iteration control.
ORA-06550: line 5, column 3:
PL/SQL: Statement ignored
declare
type tt is table of number index by varchar2(10 char);
t tt;
begin
t := tt(for k varchar2(10 char), v number in pairs of (execute immediate q'[select 'one' k, 100 v from dual union all select 'two', 200 from dual]') index k => v);
for k, v in pairs of t loop
dbms_output.put_line(k||'='||v);
end loop;
end;
/
ORA-06550: line 5, column 11:
PLS-00801: internal error [*** ASSERT at file pdw5.c, line 1002; Unexpected type for iterand.; Xanon__0x77b4fb50__AB[5, 11]]