Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PROC Records Count
Thank you. I found a note on this in the Oracle 8 docs, but it
doesn't quite do what I want. I'd like to know how many rows were
returned BEFORE I fetch them so that I can allocate accordingly.
Apparently on a fetch, this value only tells how many rows have been
retrieved by the latest fetch command, not by the select.
oracle docs say "
For INSERT, UPDATE, DELETE, and SELECT INTO statements,
sqlca.sqlerrd[2]
records the number of rows
processed. For FETCH statements, it records the cumulative sum of
rows processed.
When using host arrays with FETCH, to find the number of rows
returned
by the most recent iteration, subtract the
current value of sqlca.sqlerrd[2] from its previous value (stored
in
another variable). In the following example, you
determine the number of rows returned by the most recent fetch: "
I could declare my array to be an arbitrary length, and then fetch N records at a time, but this is still inconvenient for allocating. Is there a way to find out?
Thanks,
Sarah Officer
officers_at_aries.tucson.saic.com
Sybrand Bakker wrote:
>
> In older versions of pro products this used to be returned in
> sqlca.sqlerrd[3]. Probably you should check out the docs whether that's
> still true.
>
> Hth,
>
> --
> Sybrand Bakker, Oracle DBA
> Sarah Officer <officers_at_aries.tucson.saic.com> wrote in message
> news:389F039F.ED2660D8_at_aries.tucson.saic.com...
> > I am using PROC to access my oracle database. When I exec a SQL
> > statement, I don't see how to figure out the number of records that
> > were returned without fetching the results and counting. Is there a
> > way to extract the number of rows returned WITHOUT executing 2
> > statements, the first of which is a count?
> >
> > Thanks,
> >
> > Sarah Officer
> > officers_at_aries.tucson.saic.com
Received on Mon Feb 07 2000 - 12:30:48 CST
![]() |
![]() |