If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > initialisation of varray(ORACLE 8i)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-04-03, 10:33
ibra ibra is offline
Registered User
 
Join Date: Mar 2003
Location: brussels
Posts: 3
initialisation of varray(ORACLE 8i)

Hello,
I created a package that compiled perfect but when I executed I'm getting an error of type uninitialised collection because I'm using a varray that isn't initialised. I can't initialised the varray because it has too many elements and if I do initialised only a couple of elements I get a run time error Subscript beyond count.
Thanks for helping.
Ibra
Reply With Quote
  #2 (permalink)  
Old 03-04-03, 11:16
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
Re: initialisation of varray(ORACLE 8i)

[QUOTE][SIZE=1]Originally posted by ibra
When you declare the VARRAY you can initialise it like this:

DECLARE
TYPE t IS VARRAY(100) OF NUMBER;
var t := t();
...

You can then use the EXTEND method to make all the subscripts valis:

BEGIN
var.extend(100);

You can now access any element of var.
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
  #3 (permalink)  
Old 03-04-03, 11:23
ibra ibra is offline
Registered User
 
Join Date: Mar 2003
Location: brussels
Posts: 3
Talking Re: initialisation of varray(ORACLE 8i)

hello Andrew
Thanks a lot for your help that was the peace of the puzzle and in top of it I'm a new pl/sql prog
Ibra
[QUOTE][SIZE=1]Originally posted by andrewst
Quote:
Originally posted by ibra
When you declare the VARRAY you can initialise it like this:

DECLARE
TYPE t IS VARRAY(100) OF NUMBER;
var t := t();
...

You can then use the EXTEND method to make all the subscripts valis:

BEGIN
var.extend(100);

You can now access any element of var.
Reply With Quote
  #4 (permalink)  
Old 03-04-03, 11:27
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
Re: initialisation of varray(ORACLE 8i)

Quote:
Originally posted by ibra
hello Andrew
Thanks a lot for your help that was the peace of the puzzle and in top of it I'm a new pl/sql prog
Ibra
That's OK. I can't say I really understand WHY you have to "extend" a VARRAY just to use the elements you already declared!
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
  #5 (permalink)  
Old 03-04-03, 11:44
ibra ibra is offline
Registered User
 
Join Date: Mar 2003
Location: brussels
Posts: 3
Re: initialisation of varray(ORACLE 8i)

You right andrew I don't understand either.
I have another question because now I'm getting an error of type
ERREUR à la ligne 1 :
ORA-01840: input value not long enough for date format
ORA-06512: at "INTRA.OPR_PCK_CATIT", line 160
ORA-06512: at line 1
and actually the line his refering too is like this
FETCH C_initFldInf INTO A,B,C,D,E,F,G,H,I;
Thanks

Quote:
Originally posted by andrewst
That's OK. I can't say I really understand WHY you have to "extend" a VARRAY just to use the elements you already declared!
Reply With Quote
  #6 (permalink)  
Old 03-04-03, 12:12
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
Re: initialisation of varray(ORACLE 8i)

There must be a TO_DATE in the select statement of that cursor on a VARCHAR2 value that is not in the right format.

Example:

SQL> select to_date('01-JAN','DD-MON-YYYY') from dual
2 /
select to_date('01-JAN','DD-MON-YYYY') from dual
*
ERROR at line 1:
ORA-01840: input value not long enough for date format
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On