I have a package that returns a ref cursor. For example:

create or replace package test as

type gencursor is ref cursor;

procedure mytest(
x out gencursor);

end test;
/

create or replace package body test as

procedure mytest(
x out gencursor) as

rc gencursor;

begin

open rc for
select a,b,c,d from test_tables;

return;
end mytest;

end test;
/

Then in SQLPlus I have

declare
x test.gencursor;
begin
test.mytest(x);
for v1 in x loop
dbms_output.put_line(x.a||' '||x.b||' '||x.c||' '||x.d);
end loop;
end;
/

for v1 in x loop
*
ERROR at line 5:
ORA-06550: line 5, column 11:
PLS-00221: 'X' is not a procedure or is undefined
ORA-06550: line 5, column 1:
PL/SQL: Statement ignored


How do I iterate through the cursor that is being passed back from my procedure???


Thanks for your help.