Collection Help
Date: Wed, 14 Mar 2012 14:26:02 -0700 (PDT)
Message-ID: <82d57d6c-b135-494e-83c7-16c4a56c8547_at_v22g2000yqm.googlegroups.com>
Hi,
I have a multi-level collection, indexed by VARCHAR2. After I fill it I try and traverse it and print out data and I'm getting an error. Can anyone see maybe what I am doing wrong?? Here is my code.
The actual error is referring to the first FOR index1 loop.
Thanks in advance!
TYPE order_rec IS RECORD (
order_date DATE, order_cnt NUMBER, order_amt NUMBER);
TYPE order_tab IS TABLE OF order_rec INDEX BY VARCHAR2(30);
TYPE registration_rec IS RECORD (
date_registered DATE, total_registered NUMBER, order_data ORDER_TAB);
TYPE registration_tab IS TABLE OF registration_rec INDEX BY VARCHAR2(30); v_order_tab REGISTRATION_TAB;
BEGIN
.
.
FOR index1 IN v_order_tab.FIRST .. v_order_tab.LAST LOOP v_string1 := TO_CHAR(v_order_tab(index1).date_registered,'Month YYYY') || ',' || v_order_tab(index1).total_registered;
v_string2 := NULL;
FOR index2 IN v_order_tab(index1).order_data.FIRST ..
v_order_tab(index1).order_data.LAST LOOP
v_string2 := v_string2 ||
TO_CHAR(v_order_tab(index1).order_data(index2).order_date,'Month') ||
',' ||
v_order_tab(index1).order_data(index2).order_cnt || ',' ||
v_order_tab(index1).order_data(index2).order_amt;
END LOOP;
UTL_FILE.PUT_LINE(v_file_id,v_string1 || ',' || v_string2);
END LOOP;
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character to number
conversion error
ORA-06512: at line 80
Received on Wed Mar 14 2012 - 16:26:02 CDT