Entry
How can I get the number of rows returned by SELECT in Oracle?
Apr 19th, 2001 17:18
Onno Benschop, Frank Olbrich, Nathan Wallace, http://www.php.net/manual/ref.oracle.php3
ora_numrows (and oci_numrows) are a bit misleading. There's no
way in oracle to tell how many rows are in a result set unless you:
a> read them all
or
b> do a select count(*) [myquery] BEFORE issuing the real select.
-----
That's the way it is in oracle (as well as in other "major" RDBMs
systems).
ora_numrows will give you the number of affected rows for an update
statement, and NOT the number of rows that are in a result set!
Sample Code from penny Qu:
$count = ociParse($conn,"select count(*) from table where condition");
OCIExecute ($count);
OCIFetchInto($count, $total) ;
echo "COUNT=$total[0] <br> ";
$total[0]is the result