In Oracle, total 36 record i am getting by using PL/SQL variable type v_arr is varray(25) of varchar2(20)
. Inside the PL/SQL block i am using 2 different FOR loop
for 2 different operation. in the 1st time i am using
For i in 1 .. v_arr.count(20) loop
and for the next time i used for i in v_arr.count(21) .. v_arr.count loop
.
after compile i got error in both the condition. How to resolve this issue. Please help me.
Building on Barbaros' example, perhaps you wanted something like this:
declare
type a_arr is table of varchar2(20);
arr a_arr := a_arr
( 'un1','un2','un3','un4','un5','un6','un7','un8','un9','un10'
, 'un11','un12','un13','un14','un15','un16','un17','un18','un19','un20'
, 'x1','x2','x3' );
begin
for i in 1..least(arr.count,20) loop
dbms_output.put_line(arr(i));
end loop;
if arr.count > 20 then
for i in 21..arr.count loop
dbms_output.put_line(arr(i));
end loop;
end if;
end;