Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to use associative array in sql?

ronald_2017Oct 9 2023 — edited Oct 9 2023

Hello All,

In Oracle 19c, I want to use associative array in sql but it gives error.

SQL> create package pkg_test
  2  is
  3    type str_type is table of integer index by varchar2(1000);
  4    arr_str str_type;
  5  end;
  6  /

Package created


SQL> 
SQL> begin
  2  
  3  pkg_test.arr_str('test 1') := 1;
  4  pkg_test.arr_str('test 2') := 2;
  5  
  6  end;
  7  /

PL/SQL procedure successfully completed


SQL> select * from table(pkg_test.arr_str);
select * from table(pkg_test.arr_str)

ORA-06553: PLS-221: 'ARR_STR' is not a procedure or is undefined

Thanks in advance

This post has been answered by Solomon Yakobson on Oct 9 2023
Jump to Answer
Comments
Post Details
Added on Oct 9 2023
27 comments
1,589 views