I have a procedure and I am trying to use a collection in where statement.
procedure purge_table is
type t_ids is table of number;
arr_ids t_ids ;
begin
select distinct (s.id) bulk collect
into arr_ids
from students s;
select count(*)
into v_deleted_row_count
from students s
where s.id in (select * from table(arr_ids));
end;
I am getting "local collection types are not allowed i SQL statements" for the line containing where statement. I searched for the error as far as I understand my syntax is correct but I dont understand what does "Assuming that your collection is defined in SQL, not just in PL/SQL, you can use the TABLE operator " mentioned in the accepted answer here: Array in IN() clause oracle PLSQL.
Also the accepted answer here
suggests the same thing as I did.
I guess it has to be related to defining a collection in SQL. Could you please help me with that?