Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 814
  • Last Modified:

How to extend the PLSQL table collection

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
Suriyaraj_Sudalaiappan
Asked:
Suriyaraj_Sudalaiappan
  • 4
  • 2
  • 2
2 Solutions
 
sdstuberCommented:
please post your code
0
 
Suriyaraj_SudalaiappanAuthor Commented:

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
 
Suriyaraj_SudalaiappanAuthor Commented:
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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
slightwv (䄆 Netminder) Commented:
please post more of the code...

like the declaration for v_mo_exist_check
0
 
Suriyaraj_SudalaiappanAuthor Commented:
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
 
slightwv (䄆 Netminder) Commented:
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
 
sdstuberCommented:
dbms_sql.varchar2a  IS an associative array indexed by binary_integer


that's the problem.  Don't extend
0
 
Suriyaraj_SudalaiappanAuthor Commented:
GOOD
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now