Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 812
  • 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
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
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

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

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