Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Returning resultset from Stored proc
a cursor is what is created by the select statement which
creates the record set.
To pass a cursor between procedures as a parameter you need a cursor variable (a ref cursor).
the ref cursor must have a type declaration before you can declare variables of that type.
type declarations are made in packages.
For any more info you will need to go to the manual or help files
hugh
kev wrote in message <38B53E91.77B732D4_at_fast.no>...
>Thanks. I don't understand some of it though. What's a ref cursor?
>Why must I create a package to be able to do this?
>
>thanks,
>
>- Kev
>
>
>Hugh Pendry wrote:
>
>> Yes
>>
>> (following syntax may be a bit off)
>>
>> declare a ref cursor type in a package:-
>> e.g.
>> CREATE OR REPLACE
>> PACKAGE MyPackage
>> type myRefCursor is ref cursor;
>>
>> then pass this as a parameter to your stored proc:-
>> e.g.
>> procedure GetEmployees
>> (
>> boss_in IN varchar2,
>> employees_inout IN OUT MyPackage.myRefCursor
>> )
>> is
>> begin
>> open employees_inout for
>> select
>> employeeID,
>> employeeName,
>> from
>> employee
>> where
>> boss = boss_in;
>> end;
>>
>> kev wrote in message <38B4FE71.EBE3BF84_at_fast.no>...
>> >Hi,
>> >
>> >I want to write a stored procedure which will perform a query and return
>> >the result. I know how to return values via IN OUT variables, but can I
>> >return a whole resultset?
>> >Example code would be appreciated, the simpler the better.
>> >
>> >thanks,
>> >
>> >- Kev
>> >
>
Received on Thu Feb 24 2000 - 11:01:41 CST