Hi Experts,
Need help in above error. i am using Varray for processing multi-column data in PLSQL data.
Below is the code. This code is executing but also giving above error in the output screen.
Also find the error which we are getting. Here I am also getting the expected output but also with the error. Can anybody guide me solving this issue?
===============================CODE=====================================
declare
today_date DATE := TRUNC(SYSDATE);
v_count NUMBER := 0;
Type QNUMBER_ARRAY is varray(4) of varchar2(255);
Type QNUMBER_TYPE IS TABLE OF QNUMBER_ARRAY;
QNUMBER QNUMBER_TYPE := QNUMBER_TYPE();
begin
QNUMBER := new QNUMBER_TYPE(null);
--QNUMBER := QNUMBER_TYPE();
QNUMBER.EXTEND(100);
--
QNUMBER (1) := QNUMBER_ARRAY('QXH8000','15-NOV-16','31-DEC-9999','Admin');
QNUMBER (2) := QNUMBER_ARRAY('QXN1326','15-NOV-16','31-DEC-9999','AG');
QNUMBER (3) := QNUMBER_ARRAY('QXI1870','15-NOV-16','31-DEC-9999','VG_DE');
QNUMBER (4) := QNUMBER_ARRAY('QXK9666','15-NOV-16','31-DEC-9999','VG_CH');
DBMS_OUTPUT.put_line( '1 ' || QNUMBER(1)(1) );
FOR i IN 1 .. QNUMBER.count
LOOP
DBMS_OUTPUT.put_line( '5 ' || QNUMBER(i)(1) );
DBMS_OUTPUT.put_line( '6 ' || QNUMBER(i)(2) );
DBMS_OUTPUT.put_line( '7 ' || QNUMBER(i)(3) );
DBMS_OUTPUT.put_line( '8 ' || QNUMBER(i)(4) );
END LOOP;
end;
==========================================================================
Below is the error which we are getting.
=============================ERROR=======================================
ORA-06531: Reference to uninitialized collection
ORA-06512: at line 26
06531. 00000 - "Reference to uninitialized collection"
*Cause: An element or member function of a nested table or varray
was referenced (where an initialized collection is needed)
without the collection having been initialized.
*Action: Initialize the collection with an appropriate constructor
or whole-object assignment.
1 QXH8000
5 QXH8000
6 15-NOV-16
7 31-DEC-9999
8 Admin
5 QXN1326
6 15-NOV-16
7 31-DEC-9999
8 AG
5 QXI1870
6 15-NOV-16
7 31-DEC-9999
8 VG_DE
5 QXK9666
6 15-NOV-16
7 31-DEC-9999
8 VG_CH
====================================================================