Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: cursor fetching
Hi Daniel,
the example you sent is fine, but it's quite a simple example.
In my case, there's no table for the %ROWTYPE of which you could define a
variable, since the columns it returns don't correspond to any table's
rowtype. What to do then? And you don't know the rowtype of the cursor in
advance, either. You only know that the columns in the cursor contain some
of those relevant to your computations.
Gus
"Daniel Morgan" <damorgan_at_x.washington.edu> wrote in message
news:1091075812.754825_at_yasure...
> Agoston Bejo wrote:
>
> > Hi,
> > I have a procedure that returns a REF CURSOR (defined as
TYPES.ref_cursor).
> > After getting the cursor I would like to iterate over it, which I can do
> > with the FETCH statement. Is there a way not to have to define as much
> > variables for the FETCH as the number of columns in the cursor? Here's
what
> > I mean:
> >
> > procedure x(c out types.ref_cursor);
> > ...
> > declare
> > c types.ref_cursor;
> > x1 ...; -- var. declarations with the appropriate types
> > x2 ...;
> > x3 ...;
> > x4 ...;
> > begin
> > x(c);
> > loop
> > fetch c into x1,x2,x3,x4;
> > do_something_with(x4); -- I need only x4
> > end loop;
> > end;
> >
> > So only need x4, and I wouldn't like to have to also define x1, x2, x3
in
> > vain.
> >
> > Thx,
> > Gus
>
> Look at the examples at:
> http://www.psoug.org/reference/ref_cursors.html
>
> --
> Daniel A. Morgan
> University of Washington
> damorgan_at_x.washington.edu
> (replace 'x' with 'u' to respond)
>
Received on Mon Aug 02 2004 - 02:38:33 CDT
![]() |
![]() |