Hello Everyone,
How can i assign the value of one collection to another. I have created 2 varrays and trying to assign the value of 1 varray to another.
Can you kindly suggest as to why i am not getting the values of varray v2 in the output below? Also is it possible to assign the entire contents of v1 i.e
1 to 5 to v2 at one time (without using for loop as it assigns one at a time). Thanks.
This is the sample anonymous blobk i have awritten.
set serveroutput on
declare
type t1 is varray(5) of number;
v1 t1:=t1();
type t2 is varray(5) of number;
v2 t2:=t2();
begin
for i in 1..5
loop
v1.extend;
v2.extend;
v1(v1.last):=i;
dbms_output.put_line('the values of v1 is '||v1(i));
v1(i):=v2(i);
dbms_output.put_line('the values of v2 is '||v2(i));
end loop;
end;
The output i get is :
PL/SQL procedure successfully completed.
the values of v1 is 1
the values of v2 is
the values of v1 is 2
the values of v2 is
the values of v1 is 3
the values of v2 is
the values of v1 is 4
the values of v2 is
the values of v1 is 5
the values of v2 is
Thanks
Gautam