Home » RDBMS Server » Server Administration » Re: Ref Cursor
Re: Ref Cursor [message #369665] Mon, 21 February 2000 13:27
Suresh
Messages: 189
Registered: December 1998
Senior Member
Create or Replace Package test is
Cursor crectest is select emp_id,name from emp;

TYPE RefCurTest IS REF CURSOR RETURN crectest%rowtype ;
Procedure ctest(crec out refcurtest) ;
end;
/
create or replace package body test is
Procedure ctest(crec out refcurtest) is

begin
open crec for
select emp_id,name from emp;

end;
end;
/

Call this procedure from any where you want..
for example..you can call this procedure using following pl/sql block

declare
c1 test.refcurtest;
srec c1%rowtype;
begin
test.ctest(c1);
-- fetch values into local record type or variable
Loop
fetch c1 into srec ;
dbms_output.putline(srec.name);
IF c1%notfound THEN
exit;
END IF;
END LOOP;
end;
Previous Topic: Syntax question SP
Next Topic: Re: Self Join- Corelated subquery
Goto Forum:
  


Current Time: Sun Dec 22 05:22:20 CST 2024