dbTalk Databases Forums  

Subscript beyond count ERROR WHILE INSERTING IN A COLLECTION

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Subscript beyond count ERROR WHILE INSERTING IN A COLLECTION in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
testmirora@hotmail.com
 
Posts: n/a

Default Subscript beyond count ERROR WHILE INSERTING IN A COLLECTION - 12-20-2004 , 02:43 PM






Hi,

COULD ANYBODY HELP ME UNDERSTAND THIS ERROR PLEASE,

I'm trying to initialize a collection ALREADY DEFINE.

DESC SEARCH_X;

SEARCH_X TABLE OF SEARCH_P_TYPE
Name Null? Type
------------------------- -------- --------
ID VARCHAR2(10)
VALUE VARCHAR2(90)

and then I ADD SOME VALUES TO THE SEARCH_X:

DECLARE

c_tab SEARCH_X := SEARCH_X();
c_count number (5);

BEGIN
c_tab(1).ID := '100000';
c_tab(1).VALUE := 'TRYING TO TEST ';
c_count := c_tab.count;
DBMS_OUTPUT.PUT_LINE('C_COUNT VALUE IS ' || TO_CHAR(c_count));
END;
/

AND I GET THIS ERROR :
ERROR at line 1:
ORA-06533: Subscript beyond count
ORA-06512: at line 7

WHAT COULD BE BEYOND COUNT HERE AS THE STRING'SIZE RESPECT THE
DECLARATION ?

THANK YOU ALL.


Reply With Quote
  #2  
Old   
Thomas Kyte
 
Posts: n/a

Default Re: Subscript beyond count ERROR WHILE INSERTING IN A COLLECTION - 12-20-2004 , 04:09 PM






In article <1103575412.682308.53260 (AT) c13g2000cwb (DOT) googlegroups.com>,
testmirora (AT) hotmail (DOT) com says...
Quote:
Hi,

COULD ANYBODY HELP ME UNDERSTAND THIS ERROR PLEASE,

I'm trying to initialize a collection ALREADY DEFINE.

DESC SEARCH_X;

SEARCH_X TABLE OF SEARCH_P_TYPE
Name Null? Type
------------------------- -------- --------
ID VARCHAR2(10)
VALUE VARCHAR2(90)

and then I ADD SOME VALUES TO THE SEARCH_X:

DECLARE

c_tab SEARCH_X := SEARCH_X();
c_count number (5);

BEGIN
c_tab(1).ID := '100000';
c_tab(1).VALUE := 'TRYING TO TEST ';
c_count := c_tab.count;
DBMS_OUTPUT.PUT_LINE('C_COUNT VALUE IS ' || TO_CHAR(c_count));
END;
/

AND I GET THIS ERROR :
ERROR at line 1:
ORA-06533: Subscript beyond count
ORA-06512: at line 7

WHAT COULD BE BEYOND COUNT HERE AS THE STRING'SIZE RESPECT THE
DECLARATION ?

THANK YOU ALL.

http://download-west.oracle.com/docs...olls.htm#14218

you need to "extend" the collection -- you set it up "empty" -- with zero
elements.


Quote:
DECLARE

c_tab SEARCH_X := SEARCH_X();
c_count number (5);

BEGIN
c_tab.extend;

Quote:
c_tab(1).ID := '100000';
c_tab(1).VALUE := 'TRYING TO TEST ';

that would work.


--
Thomas Kyte
Oracle Public Sector
http://asktom.oracle.com/
opinions are my own and may not reflect those of Oracle Corporation


Reply With Quote
  #3  
Old   
Thomas Kyte
 
Posts: n/a

Default Re: Subscript beyond count ERROR WHILE INSERTING IN A COLLECTION - 12-20-2004 , 04:13 PM



In article <113580566.0000e99c.086 (AT) drn (DOT) newsguy.com>, Thomas Kyte says...
Quote:
In article <1103575412.682308.53260 (AT) c13g2000cwb (DOT) googlegroups.com>,
testmirora (AT) hotmail (DOT) com says...

Hi,

COULD ANYBODY HELP ME UNDERSTAND THIS ERROR PLEASE,

I'm trying to initialize a collection ALREADY DEFINE.

....

Quote:
AND I GET THIS ERROR :
ERROR at line 1:
ORA-06533: Subscript beyond count
ORA-06512: at line 7

WHAT COULD BE BEYOND COUNT HERE AS THE STRING'SIZE RESPECT THE
DECLARATION ?

THANK YOU ALL.


http://download-west.oracle.com/docs...olls.htm#14218

you need to "extend" the collection -- you set it up "empty" -- with zero
elements.


DECLARE

c_tab SEARCH_X := SEARCH_X();
c_count number (5);

BEGIN

c_tab.extend;

c_tab(1).ID := '100000';
c_tab(1).VALUE := 'TRYING TO TEST ';


that would work.


figure I'd answer the next natural question too -- what is the unreferenced
composite error I'm getting....

here is the entire example:

ops$tkyte@ORA9IR2> create type mytype as object
2 ( id varchar2(100), value varchar2(200) )
3 /

Type created.

ops$tkyte@ORA9IR2>
ops$tkyte@ORA9IR2> create type search_x as table of mytype
2 /

Type created.

ops$tkyte@ORA9IR2>
ops$tkyte@ORA9IR2> DECLARE
2 c_tab SEARCH_X := SEARCH_X();
3 c_count number (5);
4 BEGIN
5 c_tab.extend;
6 c_tab(1) := myType( '10000', 'Trying to test' );
7 c_count := c_tab.count;
8 DBMS_OUTPUT.PUT_LINE('C_COUNT VALUE IS ' || TO_CHAR(c_count));
9 END;
10 /
C_COUNT VALUE IS 1

PL/SQL procedure successfully completed.


--
Thomas Kyte
Oracle Public Sector
http://asktom.oracle.com/
opinions are my own and may not reflect those of Oracle Corporation


Reply With Quote
  #4  
Old   
DA Morgan
 
Posts: n/a

Default Re: Subscript beyond count ERROR WHILE INSERTING IN A COLLECTION - 12-20-2004 , 06:46 PM



testmirora (AT) hotmail (DOT) com wrote:

Quote:
Hi,

COULD ANYBODY HELP ME UNDERSTAND THIS ERROR PLEASE,

I'm trying to initialize a collection ALREADY DEFINE.

DESC SEARCH_X;

SEARCH_X TABLE OF SEARCH_P_TYPE
Name Null? Type
------------------------- -------- --------
ID VARCHAR2(10)
VALUE VARCHAR2(90)

and then I ADD SOME VALUES TO THE SEARCH_X:

DECLARE

c_tab SEARCH_X := SEARCH_X();
c_count number (5);

BEGIN
c_tab(1).ID := '100000';
c_tab(1).VALUE := 'TRYING TO TEST ';
c_count := c_tab.count;
DBMS_OUTPUT.PUT_LINE('C_COUNT VALUE IS ' || TO_CHAR(c_count));
END;
/

AND I GET THIS ERROR :
ERROR at line 1:
ORA-06533: Subscript beyond count
ORA-06512: at line 7

WHAT COULD BE BEYOND COUNT HERE AS THE STRING'SIZE RESPECT THE
DECLARATION ?

THANK YOU ALL.
In addition to Tom Kyte's comment, perhaps also something like this:

CREATE OR REPLACE TYPE InStrTab IS TABLE OF VARCHAR2(4000);
/

DECLARE

stringary InStrTab;

BEGIN
-- initialize collection
stringary := InStrTab('');
-- extend the collection to the size of the PL/SQL table
stringary.EXTEND(100);
END;
/
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace 'x' with 'u' to respond)


-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
http://www.newsfeed.com The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----


Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.