Home » SQL & PL/SQL » SQL & PL/SQL » Reference to uninitialized collection
Reference to uninitialized collection [message #267405] Thu, 13 September 2007 03:51 Go to next message
subbu_tce
Messages: 98
Registered: July 2007
Location: pune
Member
Am having the below code and i tried to call this procedure through front end java application at that time am getting
Reference to uninitialized collection .

plz give me the solution.

CREATE OR REPLACE PROCEDURE upload_transac_dtls
(
p_trans_dtls IN WEO_REC_STRINGS10_list,
p_trans_rslt OUT WEO_REC_STRINGS10_list
)
AS
-- Declaring the types to hold the values .
------------------------------------------------------------------------------------
TYPE obj_application_no IS TABLE OF VARCHAR2(30) INDEX BY BINARY_INTEGER;
TYPE obj_amt_collected IS TABLE OF NUMBER(10) INDEX BY BINARY_INTEGER;
TYPE obj_amt_collected_dt IS TABLE OF VARCHAR2(30) INDEX BY BINARY_INTEGER;
TYPE obj_transaction_id IS TABLE OF VARCHAR2(100) INDEX BY BINARY_INTEGER;
TYPE obj_status IS TABLE OF VARCHAR2(1) INDEX BY BINARY_INTEGER;
TYPE obj_remarks IS TABLE OF VARCHAR2(100) INDEX BY BINARY_INTEGER;

lst_obj_application_no obj_application_no;
lst_amt_collected obj_amt_collected;
lst_amt_collected_dt obj_amt_collected_dt;
lst_transaction_id obj_transaction_id;
lst_status obj_status;
lst_remarks obj_remarks;


cnt NUMBER;

---------------------------------------------------------------------------------------

BEGIN
-------------------------------------------------------------------------------------
p_trans_rslt :=WEO_REC_STRINGS10_list();
--------------------------------------------------------------------------------------
-- Assigning values in the list


FOR appRec IN p_trans_dtls.FIRST ..p_trans_dtls.LAST LOOP
lst_obj_application_no (appRec) :=p_trans_dtls(appRec).STRINGVAL1;
lst_amt_collected (appRec) :=TO_NUMBER (p_trans_dtls(appRec).STRINGVAL2);
lst_amt_collected_dt (appRec) :=p_trans_dtls(appRec).STRINGVAL3;
lst_transaction_id (appRec) :=p_trans_dtls(appRec).STRINGVAL4;

END LOOP;

--------------------------------------------------------------------------------------
-- Bulk inserting the data
FORALL transRec IN p_trans_dtls.FIRST..p_trans_dtls.LAST save EXCEPTIONS
INSERT install_schedule
(
application_no,
amt_collected,
amt_collected_dt,
transaction_id,
status,
remarks,
INSTALL_DATE
)
VALUES (
lst_obj_application_no(transRec),
lst_amt_collected(transRec),
lst_amt_collected_dt(transRec),
lst_transaction_id(transRec),
NULL,
NULL,
'20-Jan-1980'
);
COMMIT;

--------------------------------------------------------------------------------------
EXCEPTION
WHEN OTHERS THEN
cnt:=SQL%bulk_exceptions.COUNT;
FOR rec IN 1..cnt LOOP
p_trans_rslt.EXTEND ();
p_trans_rslt (p_trans_rslt.COUNT ()) :=
weo_rec_strings10(
SUBSTR(SQLERRM (0-SQL%bulk_exceptions(rec).error_code),11,LENGTH(SQLERRM (0-SQL%bulk_exceptions(rec).error_code))),
(SQL%bulk_exceptions(rec).error_index+1),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL
);
dbms_output.put_line( SQLERRM (0-SQL%bulk_exceptions(rec).error_code));
END LOOP;
END upload_transac_dtls;

WEO_REC_STRINGS10_list is nothing but table of WEO_REC_STRINGS10 which is nothing but object which contains 10 fields as varchar2 datatype.
Re: Reference to uninitialized collection [message #267419 is a reply to message #267405] Thu, 13 September 2007 04:34 Go to previous messageGo to next message
Michel Cadot
Messages: 64108
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Please read and follow OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format. Use the "Preview Message" button.
Please always post your Oracle version (4 decimals).

Regards
Michel
Re: Reference to uninitialized collection [message #267420 is a reply to message #267405] Thu, 13 September 2007 04:34 Go to previous message
pablolee
Messages: 2834
Registered: May 2007
Location: Scotland
Senior Member
You have been asked several times to format your posts. Do it or receive no assistance
Previous Topic: errors in procedure
Next Topic: Problem in creating table with user defined data type
Goto Forum:
  


Current Time: Mon Dec 05 05:05:41 CST 2016

Total time taken to generate the page: 0.23655 seconds