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: number of rows in cursor?

Re: number of rows in cursor?

From: tojo <Tojo_at_hotmail.com>
Date: Mon, 13 Dec 2004 10:26:37 +0100
Message-ID: <MPG.1c277eb3abf90d0e989704@news.t-online.de>


In article <8ghud.637251$mD.2711_at_attbi_s02>, kennedy- downwithspammersfamily_at_attbi.net says...
>
> "Frank Piron" <empty_at_zero.nil> wrote in message
> news:opsisl5wh3m0et4w_at_news.online.de...
> > Am Fri, 10 Dec 2004 09:45:50 +0100 schrieb eudorica
> > <snjezana.katusic_at_htnet.hr>:
> >
> > > Is there way to count a number of rows in opened cursor before fetching
> > > it
> > > (%rowcount works only after fetching)? I need to know the number of rows
> > > before enter loop. Thanks.
> > >
> > >
> >
> > You may count the rows explicitly before entering the loop.
> >
> > if the cursor statement is: select <projection-clause>
> > from ....
> >
> > you may count with: select count(rowid) into <counter_var>
> > from ....
> >
> > where <counter_var> is some local variable into which you may
> > store the number of rows the cursor will retrieve.
> >
> > --
> > Frank Piron,
> > defrankatkonaddot
> > (leftrotate two)
> Except the number could change from count to the fetch of the data.
> Jim
>
>
>

You could surround the whole thing with "SET TRANSACTION READ ONLY" and "COMMIT". Results should then be the same regardless of other sessions.

Received on Mon Dec 13 2004 - 03:26:37 CST

Original text of this message

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