so_damn_insane ([info]so_damn_insane) rakstīja,
@ 2007-08-13 14:46:00

Previous Entry  Add to memories!  Tell a Friend!  Next Entry
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;
/


(Lasīt komentārus)

Nopūsties:

No:
Lietotājvārds:
Parole:
Ievadi te 'qws' (liidzeklis pret spambotiem):
Temats:
Tematā HTML ir aizliegts
  
Ziņa:
Neesi iežurnalējies. Iežurnalēties?