Array in IN() clause oracle PLSQL

Assuming that your collection is defined in SQL, not just in PL/SQL, you can use the TABLE operator (the definition you posted isn’t syntactically valid– you’d need to specify a length for the VARCHAR2)

AND p.plc_status IN (SELECT column_value
                       FROM TABLE( plcListchar ))

Since I don’t have your tables, an example using the SCOTT schema

SQL> create type ename_tbl is table of varchar2(30);
  2  /

Type created.

SQL> ed
Wrote file afiedt.buf

  1  declare
  2    l_enames ename_tbl := ename_tbl( 'KING', 'SMITH' );
  3  begin
  4    for i in (select *
  5                from emp
  6               where ename in (select column_value
  7                                 from table( l_enames )))
  8    loop
  9      dbms_output.put_line( 'ENAME = ' || i.ename );
 10    end loop;
 11* end;
SQL> /
ENAME = KING
ENAME = SMITH

PL/SQL procedure successfully completed.

Leave a Comment