Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Returning resultset from Stored proc

Re: Returning resultset from Stored proc

From: Hugh Pendry <hpendry_at_trinitech.nospam.co.uk>
Date: Thu, 24 Feb 2000 17:01:41 -0000
Message-ID: <893o5o$obi$1@trinitech.demon.co.uk>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US