Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Subscript beyond count ERROR WHILE INSERTING IN A COLLECTION

Re: Subscript beyond count ERROR WHILE INSERTING IN A COLLECTION

From: Thomas Kyte <tkyte_at_oracle.com>
Date: 20 Dec 2004 14:13:21 -0800
Message-ID: <113580801.0000ed12.055@drn.newsguy.com>


In article <113580566.0000e99c.086_at_drn.newsguy.com>, Thomas Kyte says...
>
>In article <1103575412.682308.53260_at_c13g2000cwb.googlegroups.com>,
>testmirora_at_hotmail.com says...
>>
>>Hi,
>>
>>COULD ANYBODY HELP ME UNDERSTAND THIS ERROR PLEASE,
>>
>>I'm trying to initialize a collection ALREADY DEFINE.
>>

...

>>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/cd/B10501_01/appdev.920/a96624/05_colls.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_at_ORA9IR2> create type mytype as object   2 ( id varchar2(100), value varchar2(200) )   3 /  

Type created.  

ops$tkyte_at_ORA9IR2>
ops$tkyte_at_ORA9IR2> create type search_x as table of mytype   2 /  

Type created.  

ops$tkyte_at_ORA9IR2>
ops$tkyte_at_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
Received on Mon Dec 20 2004 - 16:13:21 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US