Uw array moet een SQL-objecttype zijn, rechtstreeks in SQL gemaakt, geen PLSQL-type gedeclareerd in een pakket:
SQL> CREATE OR REPLACE TYPE t_strarray IS TABLE OF VARCHAR2(30);
2 /
Type created.
SQL> CREATE TABLE mytable (field1 VARCHAR2(30));
Table created.
SQL> INSERT INTO mytable VALUES ('A');
1 row created.
SQL> INSERT INTO mytable VALUES ('D');
1 row created.
SQL> CREATE OR REPLACE PROCEDURE getstuff(p_list IN t_strarray,
2 io_cursor OUT SYS_REFCURSOR) IS
3 BEGIN
4 OPEN io_cursor FOR
5 SELECT *
6 FROM mytable
7 WHERE mytable.field1 IN (SELECT COLUMN_VALUE FROM TABLE(p_list));
8 END;
9 /
Procedure created.
SQL> VARIABLE cc REFCURSOR;
SQL> EXEC getstuff (t_strarray('A', 'B', 'C'), :cc);
PL/SQL procedure successfully completed.
SQL> print cc
FIELD1
------------------------------
A