Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to extend the PLSQL table collection

Posted on 2011-02-25
8
Medium Priority
?
810 Views
Last Modified: 2012-06-21
Hi,

I have initialized PLSQL tabletype and i just assign the element to the tabletype instead of staring from the 1. My value is 2014829 for tabletype index. When i assign the value i am getting the below error "Subscribe beyond count". When i extend n the element it has entended till 2014829. But i am doing this in the loop. My second value will be 2014830. And again the index extended till 4029659.

How do i stop this? please help me..

Thanks
0
Comment
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 74

Expert Comment

by:sdstuber
ID: 34980871
please post your code
0
 

Author Comment

by:Suriyaraj_Sudalaiappan
ID: 34980890

v_mo_num := TO_NUMBER(REPLACE(v_buffer,v_job_no_prefix,NULL));

                        IF v_mo_exist_check.EXISTS(v_mo_num)
                        THEN
                            v_mo_num_check := FALSE;                            
                        ELSE
                            v_mo_num_check := TRUE;
                            v_mo_exist_check.EXTEND(v_mo_num);                            
                            v_mo_exist_check(v_mo_num)  := v_buffer;
                       END IF;

Open in new window

0
 

Author Comment

by:Suriyaraj_Sudalaiappan
ID: 34980908
I posted my code. Thius logic will be in the loop where the value of v_mo_num will be contains the different value.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 34980932
please post more of the code...

like the declaration for v_mo_exist_check
0
 

Author Comment

by:Suriyaraj_Sudalaiappan
ID: 34980998
v_mo_exist_check is just the tabletype declartion "DBMS_SQL.varchar2a"

v_buffer is nothing but the value string. i am just getting only the number value to v_mo_num and passed the value to tabletype element.
0
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 1000 total points
ID: 34981062
Why not just use a plsql table indexed by binary integer?

Then you don't have to worry about extend.
declare
		TYPE myType IS TABLE OF varchar2(50) INDEX BY BINARY_INTEGER;
		myArr myType;
begin

	myArr(123) := 'Tom';
	myArr(999) := 'Dick';
	myArr(123456) := 'Harry';


	dbms_output.put_line('count: ' || myArr.count);

end;
/

Open in new window

0
 
LVL 74

Assisted Solution

by:sdstuber
sdstuber earned 1000 total points
ID: 34981089
dbms_sql.varchar2a  IS an associative array indexed by binary_integer


that's the problem.  Don't extend
0
 

Author Closing Comment

by:Suriyaraj_Sudalaiappan
ID: 34982966
GOOD
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question