--- Tested enviroment Oracle11g
---- Win Xp
CREATE OR REPLACE PACKAGE A1 IS
PROCEDURE test(result_ OUT SYS_REFCURSOR);
END A1;
/
CREATE OR REPLACE PACKAGE BODY A1
AS
PROCEDURE test(result_ OUT SYS_REFCURSOR)
IS
BEGIN
OPEN result_ FOR SELECT C1 FROM VARCHARTAB;
END test;
end ;
/
INSERT INTO VARCHARTAB VALUES (' Michael Georgiou');
commit;
declare
result_ SYS_REFCURSOR;
r varchar2(4000);
begin
A1.test(result_);
LOOP
FETCH result_ INTO r;
EXIT WHEN result_%NOTFOUND;
dbms_output.put_line(r);
END LOOP;
CLOSE result_;
end;
/