declare
pos_mods_rowid price_event_pkg.rowid_type;
i number;
j number;
begin
price_event_pkg.pos_items_stage(1, 100, sysdate, pos_mods_rowid);
dbms_output.put_line(pos_mods_rowid(1));
i:=price_event_pkg.delete_pos_mods(pos_mods_rowid);
end;
/

I have a package that outputs pl/sql table of rowids and uses that rowids to delete rows from the table after processing.

The problem is when I pass the collection (pl/sql table) to the procedure it deletes only the last row. What is wrong. Here is the code that deletes the row.


FUNCTION DELETE_POS_MODS (pos_mods_rowid in rowid_type) Return Number
Is
v_commit_level Number := 5000;
l_cnt1 Number := 0;
indx Number := 0;
Begin
FOR indx IN pos_mods_rowid.FIRST .. pos_mods_rowid.LAST
loop
dbms_output.put_line(pos_mods_rowid(indx)));
Delete
From pos_mods
Where rowid = pos_mods_rowid(indx);
l_cnt1 := l_cnt1 + 1;
If Mod(l_cnt1,v_commit_level) = 0 Then
Commit;
End If;
End Loop;
Commit;
Return l_cnt1;
Exception
........
End DELETE_POS_MODS;
/