Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Return rows from a package
A cursor is a cursor is a cursor. Not relevant that it is a ref cursor.
The application decides how many rows to get and gets them when it wants.
If you were just doing a select.... then you would fetch the rows as you
wanted to in the application. Same with a package.
Jim
"Andy Rigby" <andy_at_softap.co.uk> wrote in message
news:56c32d01.0202221049.6a3cea76_at_posting.google.com...
> Hi
>
> I'm trying to write a package procedure that will return a certain
> number of rows from a cursor, back to ADO. I am using the Oracle OLE
> DB provider, with Visual C++ at the front end.
>
> I have managed to create a procedure that returns all the rows in the
> cursor by declaring it as a REF CURSOR in the usual way in the package
> header.
>
> What I cannot quite get straight in my head is how to return just some
> rows. I can of course set up a LOOP on the opened cursor, but then how
> do I return the rows that I fetch? I looked into creating a temp table
> but that seems a slow method to me, also I can't see how to insert
> FETCHed rows from my cursor into the temp table.
>
> I don't want to use ROWNUM<n on the cursor statement because there are
> performance problems with that approach with the complex SELECTs that
> I am using for my cursors (which is why I am trying to code it myself
> in a procedure).
>
> Alternatively, I wouldn't mind doing it via an Oracle table (ie array)
> - the only problem with that approach is that the routine is supposed
> to be general purpose so the structure of the cursor will be
> undefined.
>
> All advice much appreciated,
>
> Andy Rigby
Received on Fri Feb 22 2002 - 20:58:15 CST