Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How can I pass Recordsets as input parameter to a Function / Stored Proc ?
krislioe_at_gmail.com wrote:
> Hi Mr Bakker, > >> in your procedure just >> open <mypackage>.mycursor(12345); >> fetch into <whatever> > This what I try to avoid : row by row operation, my order detail could > be 75 - 100 items. > > I want to do the stock taking in one single query, and Insert the > resultset to Order_By_Batch Table. > > Isn't it inefficient to fetch row by row compared to single query ? > > Thank you, > xtanto > > > > sybrandb wrote: >> On Feb 13, 12:53 pm, krisl..._at_gmail.com wrote:
>> First of all, as far as I know you can't use a recordset as an input >> parameter. You could use a collection as input parameter, and bulk >> collect into that collection, >> but that would still be pretty inefficient and not needed for your >> requirement, as you could do with a CURSOR defined in a package SPEC >> (not in a body), which can be used by multiple procedures and get >> opened and opened again. The orderno would be the parameter to the >> cursor >> cursor my_cursor(p_orderno in number) is >> select * from orderhist >> where orderno = p_orderno; >> >> in your procedure just >> open <mypackage>.mycursor(12345); >> fetch into <whatever> >> >> -- >> Sybrand Bakker >> Senior Oracle DBA
Please do not top post.
If your function receives parameters and returns a ref cursor. Where would you need to do single-row processing?
You could process the ref cursor in a FOR LOOP just as is demonstrated in Morgan's Library at www.psoug.org under REF CURSORS.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.orgReceived on Tue Feb 13 2007 - 12:22:29 CST
![]() |
![]() |