* Two ways of populating index by V2 associative arrays. * Now, how does it perform in real time? * How do you find out what subscripts are used in the array? * You cann't loop though (i in 1..x.count) and get x(i) anymore. SQL> declare 2 cursor c1 is select ccode, cname from country; 3 type tab1 is table of char(2) index by pls_integer; 4 type tab2 is table of varchar2(50) index by pls_integer; 5 v_tab1 tab1; 6 v_tab2 tab2; 7 type tab3 is table of varchar2(50) index by varchar2(2); 8 x tab3; 9 begin 10 select ccode, cname bulk collect into v_tab1, v_tab2 from country; 11 for i in 1..v_tab1.count loop 12 x(v_tab1(i)):=v_tab2(i); 13 dbms_output.put_line('x('||v_tab1(i)||')= '||v_tab2(i)); 14 end loop; 15 end ; 16 / x(AU)= Australia x(BR)= Brazil x(DE)= Germany x(DK)= Denmark x(ES)= Spain x(FR)= France x(IE)= Ireland x(IN)= India x(JP)= Japan x(MY)= Malaysia x(NL)= The Netherlands x(NZ)= New Zealand x(PL)= Poland x(SA)= Saudi Arabia x(TR)= Turkey x(UK)= United Kingdom x(US)= United States of America x(ZA)= South Africa x(AR)= Argentina x(AU)= Australia x(BR)= Brazil x(DE)= Germany x(DK)= Denmark x(ES)= Spain x(FR)= France x(IE)= Ireland x(IN)= India x(JP)= Japan x(MY)= Malaysia x(NL)= The Netherlands x(NZ)= New Zealand x(PL)= Poland x(SA)= Saudi Arabia x(TR)= Turkey x(UK)= United Kingdom x(US)= United States of America x(ZA)= South Africa PL/SQL procedure successfully completed. SQL> declare 2 cursor c1 is select ccode, cname from country; 3 type tab3 is table of varchar2(50) index by varchar2(2); 4 x tab3; 5 begin 6 for rec in c1 loop 7 x(rec.ccode):=rec.cname; 8 dbms_output.put_line('x('||rec.ccode||')= '||rec.cname); 9 end loop; 10 end; 11 / x(AU)= Australia x(BR)= Brazil x(DE)= Germany x(DK)= Denmark x(ES)= Spain x(FR)= France x(IE)= Ireland x(IN)= India x(JP)= Japan x(MY)= Malaysia x(NL)= The Netherlands x(NZ)= New Zealand x(PL)= Poland x(SA)= Saudi Arabia x(TR)= Turkey x(UK)= United Kingdom x(US)= United States of America x(ZA)= South Africa x(AR)= Argentina x(AU)= Australia x(BR)= Brazil x(DE)= Germany x(DK)= Denmark x(ES)= Spain x(FR)= France x(IE)= Ireland x(IN)= India x(JP)= Japan x(MY)= Malaysia x(NL)= The Netherlands x(NZ)= New Zealand x(PL)= Poland x(SA)= Saudi Arabia x(TR)= Turkey x(UK)= United Kingdom x(US)= United States of America x(ZA)= South Africa PL/SQL procedure successfully completed. SQL>