Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Inconsistent SELECT results
Let me guess you are using the array interface in OCI and fetching 10 or 11
rows at a time. So count(1) works because it tells you that the row count
is 910 rows and it only has 1 row. The other query is returning those rows
but you are probably just fetching 1 time and since you are probably using
the array interface and have it defined for 11 rows you are getting the 1st
11 rows of the result set. (The array is probably defined as x[10] which
means 11 elements since in C arrays start at 0.)
Jim
"Ramon F Herrera" <ramon_at_conexus.net> wrote in message
news:c9bc36ff.0307112330.367b5583_at_posting.google.com...
> Has anybody out there seen a problem like this one?
>
> The problem in question happens only through the OCI,
> when I use SQL*Plus everything is fine.
>
> My C OCI program performs 2 queries, as follows:
>
> select count(1) from sometable where somefield='1234';
>
> and a very similar statement:
>
> select field1, field2, field3 from sometable where somefield='1234';
>
> (there are 11 fields in my real query, the above is a simplification).
>
> The "count(1)" statement correctly reports the number of hits,
> but when I request the actual data in the second query I almost
> invariably get a small percentage of the actual hits.
>
> For instance, one of the particular query should return 910 records,
> but it only returns 11.
>
> I am preparing a second Oracle server, to test the hypothesis
> of my first server having some corrupted file, but I wonder
> if any of you out there has seen this.
>
> TIA,
>
> -Ramon F. Herrera
>
> RedHat Linux 7.3
> Oracle 9iR2
Received on Sat Jul 12 2003 - 10:17:33 CDT
![]() |
![]() |