Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

HELP! assign value to varray

464755Nov 4 2005 — edited Nov 4 2005
I have the following stored procedure and when I tried to run it, I got error "ORA-06530: Reference to uninitialized composite"

CREATE OR REPLACE TYPE test_data AS OBJECT
( name VARCHAR2(30),
address VARCHAR2(30),
comment VARCHAR2(10)
);

CREATE OR REPLACE TYPE test_data_array IS VARRAY(9999) OF test_data;

CREATE OR REPLACE PROCEDURE test_data_prod
(tests OUT test_data_array)
IS
CURSOR cust_info IS
SELECT name, address, comment
FROM customer_data
WHERE comment IS NOT NULL;
v_count NUMBER;
v_loop_count NUMBER;
each_row test_data;

BEGIN
SELECT COUNT(*) INTO v_count
FROM customer_data
WHERE comment IS NOT NULL;

v_loop_count := 1;
tests := test_data_array ();

tests.EXTEND(9999);
FOR c IN cust_info LOOP
each_row.name := c.name; <-- error show on this line
each_row.address := c.address;
each_row.comment := c.comment;
tests(tests.LAST) := each_row;
v_loop_count := v_loop_count + 1;
END LOOP;

END;

What should I do?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 2 2005
Added on Nov 4 2005
2 comments
252 views