Вы находитесь на странице: 1из 2

create table temp1(n number,n1 varchar2(10)) insert into temp1 values(2,'Vikas') select

from temp1

declare type type_n is table of number; type type_n1 is table of varchar2(10); n_n type_n; n1_n1 type_n1; cursor c1 is select * from temp1; begin select n,n1 bulk collect into n_n,n1_n1 from temp1; for i in 1..2 loop dbms_output.put_line(n_n(i)||'------------'||n1_n1(i)); end loop; open c1; fetch c1 bulk collect into n_n,n1_n1; close c1; for i in 1..2 --If I gives here 1..3 it gives error beyond count loop dbms_output.put_line(n_n(i)||'------------'||n1_n1(i)); end loop; end; ******************************************************

output=>
1------------Bhakti 2------------Vikas 1------------Bhakti 2------------Vikas declare Returning clause=> type p1 is varray(7) of number;

type type_n is table of number; rep p1:=p1(1,2); totlist p1; begin Forall i in rep.first..rep.last update temp1 set n=n*2 where n=rep(i) returning n bulk collect into totlist; for i in totlist.first..totlist.last loop dbms_output.put_line(totlist(i)); end loop;

output=>
2 4 4

Вам также может понравиться