This was going to the be the immediate follow up to my previous post, but 220.127.116.11 came out and I got all excited about that and forgot to post this one 🙂
Anyway, the previous post showed how easy it is to convert between nested tables and associative arrays. The nice thing in 12c is that this is no longer needed – you can query the associative arrays directly
SQL> create or replace package PKG as 2 3 type num_list is table of number index by pls_integer; 4 5 end; 6 / Package created. SQL> SQL> declare 2 v pkg.num_list; 3 begin 4 v(1) := 10; 5 v(2) := 20; 6 7 for i in ( select * from table(v) ) loop 8 dbms_output.put_line(i.column_value); 9 end loop; 10 end; 11 / 10 20 PL/SQL procedure successfully completed.