Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle 8i OCI (newbie) Q: no. rows returned in a SELECT?
A late follow-up from the original Q poster:
select count(*) isn't always going to return the correct value, depending on whether there are NULLs in the rows.
John G.
Markus Schumann wrote:
>
> John,
>
> what about "select count(*) where ..."
>
> Markus.
>
> "John Garner" <jgarner_at_commercenti.com> wrote in message
> news:3B6E8502.8D1FCED_at_commercenti.com...
> > Hi,
> >
> > I'm a good C++ programmer, but new to Oracle and for the life of me
> > cannot find out how many rows a select query has returned via the OCI
> > and any of the attributes. Not without fetching all the rows first
> > anyway, which I don't want to have to cache in memory as there may be a
> > lot of them.
> >
> > I've tried OCIAttrGet() on the statement handle once it's
> > OCIStmtExec()'d with both OCI_ATTR_ROW_COUNT and OCI_ATTR_PARAM_COUNT,
> > but both of them appear to set it to 0(zero) - possibly the number of
> > rows fetched so far (done straight after the query).
> >
> > I can fetch the number of columns fine using OCIAttrGet and
> > OCI_ATTR_PARAM_COUNT, my OCI call for number of rows looks the same
> > apart from the different attribute I want.
> >
> > Help! Can you find out how many rows a query returns without getting
> > them all????
> >
> > John G.
Received on Thu Aug 30 2001 - 05:27:47 CDT