Biju jau aizmirsis, ka tas strādā.
create table test (id number(12), val varchar2(100));
create type t_number_table as table of number
/
create type t_varchar_table as table of varchar2(150)
/
insert into test(id, val) values (1, 'a');
insert into test(id, val) values (2, 'b');
insert into test(id, val) values (3, 'c');
insert into test(id, val) values (4, 'd');
insert into test(id, val) values (5, 'e');
declare
v_ids t_number_table;
v_vals t_varchar_table;
begin
select id
bulk collect into v_ids
from test
where rownum <=3;
forall i in 1..v_ids.count
update test
set val = val||'_new'
where id = v_ids(i)
returning val
bulk collect into v_vals;
for i in 1..v_vals.count
loop
dbms_output.put_line(v_vals(i));
end loop;
end;
/