DECLARE
CURSOR cur IS
SELECT *
FROM bigdata.controlmcopy;
TYPE controlmtable IS
TABLE OF bigdata.controlmcopy%rowtype;
v controlmtable;
PROCEDURE ptable(
formalarray OUT controlmtable
)AS
BEGIN
FOR i IN 1..500 LOOP
dbms_output.put_line(formalarray(i).jobname);
END LOOP;
END;
BEGIN
OPEN cur;
FETCH cur BULK COLLECT INTO v LIMIT 500;
ptable(v);
CLOSE cur;
END;
嗨,我想知道我需要在哪里初始化我的嵌套表'v'以及out参数模式如何与集合一起工作。 我收到此错误。
Error report -
ORA-06531: Reference to uninitialized collection
ORA-06512: at line 15
ORA-06512: at line 22
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.
我没有您的桌子,所以我改用了Scott的EMP。应该是这样的(我将您所做的错误标记为评论):