Following code:
declare
cnt number(1) :=1;
cursor c_cur is
select COUNTRY_NAME from countries where rownum <3;
type arr_name is varray(5) of VARCHAR2(40);
arr_cn arr_name :=arr_name();
begin
open c_cur;
loop
fetch c_cur into arr_cn(cnt);
exit when c_cur%notfound;
cnt := cnt+1;
end loop;
close c_cur;
end;
Caused error:
Error report -
ORA-06533: Subscript beyond count
ORA-06512: at line 10
06533. 00000 - "Subscript beyond count"
*Cause: An in-limit subscript was greater than the count of a varray
or too large for a nested table.
*Action: Check the program logic and explicitly extend if necessary.
I do not understand why, could someboy explain it?