You cannot call the PL/SQL exists
function from a SQL statement. You can reference the values in the collection if you need to:
declare
type MONTH_TYPE is table of varchar2(20) index by binary_integer;
month_table MONTH_TYPE;
mon varchar2(20);
begin
month_table(1) := 'Jan';
month_table(2) := 'Feb';
select case when month_table(1)='Jan' then 'found' else 'not found' end
into mon from dual;
end;
Or you can use exists
within PL/SQL:
declare
type MONTH_TYPE is table of varchar2(20) index by binary_integer;
month_table MONTH_TYPE;
mon varchar2(20);
begin
month_table(1) := 'Jan';
month_table(2) := 'Feb';
mon := case when month_table.exists(1) then 'found' else 'not found' end;
end;
From your comments it sounds like a database type may be the way to go:
SQL> create type MONTH_TYPE is table of varchar2(20);
Then you can select from this in your SQL:
declare
month_table MONTH_TYPE := MONTH_TYPE();
mon varchar2(20);
begin
month_table.extend;
month_table(1) := 'Jan';
month_table.extend;
month_table(2) := 'Feb';
update some_table
set x = 1
where month in (select column_value from table(month_table));
end;