ORA-06531 Reference to uninitialized collection in Oracle [message #42345] |
Thu, 20 March 2003 22:28  |
Raj
Messages: 411 Registered: November 1998
|
Senior Member |
|
|
i created a package as follows
create or replace PACKAGE SPACK_TEST AS
type my_table is table of office%rowtype;
PROCEDURE SPROC_TEST(v1 OUT varchar2, a_tab OUT my_table);
END SPACK_TEST;
/
CREATE OR REPLACE PACKAGE BODY SPACK_TEST AS
PROCEDURE SPROC_TEST(v1 out varchar2, a_tab out my_table) is
l_ctr number(2);
BEGIN
v1 := 'variable output';
l_ctr := 1;
declare cursor cur_office is
select * from office where vndrid > 0;
begin
open cur_office;
a_tab(l_ctr) := null;
fetch cur_office into a_tab(l_ctr);
loop
exit when cur_office%notfound;
l_ctr := l_ctr + 1;
a_tab(l_ctr) := null;
fetch cur_office into a_tab(l_ctr);
end loop;
close cur_office;
end;
v1 := v1 || l_ctr;
END SPROC_TEST;
END SPACK_TEST;
/
i execute this Package like this in forms/or in sql prompt itself
declare
type a_tab is table of office%rowtype;
l_tab spack_test.my_table;
v_out varchar2(100);
i number(2);
begin
begin
spack_test.sproc_test(v_out, l_tab);
exception
when others then
message('error: ' || sqlerrm, acknowledge);
pause;
end;
if l_tab.exists(1) then
i := l_tab.count;
message(v_out || ' ' || i);
pause;
end if;
for i in l_tab.FIRST..l_tab.LAST
loop
message('table ' || l_tab(i).name);
pause;
end loop;
end;
/
but i Get ORA-06531 Reference to uninitialized collection in Oracle
Can some body say where i go wrong
office is a table i have in the d/b
|
|
|
|