Home » SQL & PL/SQL » SQL & PL/SQL » Subscript Beyond Count
Subscript Beyond Count [message #36901] Wed, 02 January 2002 18:51 Go to next message
diaz
Messages: 58
Registered: October 2001
Member
Hello,

i was trying to run this code
it succeed on the win98 environment, but not in HP-UX environment

the code is :

SQL> @ tespl01.sql
SQL> declare
2 cursor s1 is select * from test;
3 TYPE myarr IS VARRAY(10) OF s1%ROWTYPE;
4 recs myarr;
5 i number :=1;
6 begin
7 recs:=myarr(null,null,null);
8 for j in s1 loop
9 recs(i).id := j.id;
10 recs(i).nama := j.nama;
11 recs(i).tgl := j.tgl;
12 dbms_output.put_line(recs(i).nama||recs(i).tgl);
13 i := i+1;
14 end loop;
15 end;
16 /
acdp
ndiaz
ksemua
declare
*
ERROR at line 1:
ORA-06533: Subscript beyond count
ORA-06512: at line 9

the error is found when ran at HP-UX environment..

i was thinking that this may be caused by the different of the environment.. but.. when i was trying another code that includes the same algorithms (in win98 environment) it still raised the exception :
Subscript Beyond Count

i've read the manual, that the problem caused by a subscript exceed the number of elements in a collection.. but.. i can't figure it out how to solve it.. can you please give me a hand..
TIA.

----------------------------------------------------------------------
Re: Subscript Beyond Count [message #36907 is a reply to message #36901] Wed, 02 January 2002 23:17 Go to previous messageGo to next message
tinel
Messages: 42
Registered: November 2001
Member
Hi

I think the problem is from the starting number of subscript, maybe in HP-UX the starting number is 0.

----------------------------------------------------------------------
Re: Subscript Beyond Count [message #36910 is a reply to message #36901] Thu, 03 January 2002 07:36 Go to previous messageGo to next message
Suresh Vemulapalli
Messages: 624
Registered: August 2000
Senior Member
there is no relation between OS and database VArrays.. you have to use extend method to extend varrays.

try this...

declare
cursor s1 is select * from test;
TYPE myarr IS VARRAY(10) OF s1%ROWTYPE;
recs myarr;
i number :=1;
begin
recs:=myarr(null,null,null);
for j in s1 loop
recs(i).id := j.id;
recs(i).nama := j.nama;
recs(i).tgl := j.tgl;
dbms_output.put_line(recs(i).nama||recs(i).tgl);
i := i+1;
recs.extend;
end loop;
end;

Suresh

----------------------------------------------------------------------
Re: Subscript Beyond Count [message #36941 is a reply to message #36907] Sat, 05 January 2002 18:48 Go to previous message
diaz
Messages: 58
Registered: October 2001
Member
hmm..
i havent try it yet in HP-UX again..
but when i tried in win98, if i change i into 0,
it'll return Subscript Beyond Limit (something like that..)

thanks anyway
Previous Topic: very much a newbe, from Visual basic
Next Topic: converting oracle datatypes to and from RAW
Goto Forum:
  


Current Time: Thu Aug 06 02:47:45 CDT 2020