I am trying to collect an array of revisions numbers.
I will use to delete records in multiple audit tables.
So I wrote a plsql to collect that array and to run delete on other tables based on condition using that array
declare
type NumberArray is table of number index by binary_integer;
revisions NumberArray;
Begin
select rev bulk collect into revisions from (
select t.rev, row_number() over (partition by
column1,
column2
order by column3) rn
from table1 t)
where rn <> 1;
dbms_output.put_line(revisions.count || ' records found from table2 to be deleted');
delete from table2 where rev in (revisions);
dbms_output.put_line('deleted from table2');
I am getting
PLS-00382: expression is of wrong type
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
Datatype of rev is number in table1.