rows does not work correctly for selects.[1] This is because oracle itself does not know how many rows are returned on the select until they have all been fetched.

rows works correctly on inserts and updates though.

[1] rows will return non-zero after the first row is fetched,, but this number will not be the total number of rows unless your result set is small.


On Thursday, November 14, 2002, at 07:07 PM, Peter Kappus wrote:

I haven't used much DBI but I suspect that your $rv2 is just a reference to
an array of rows so you might try doing something like "$rv2 =
scalar($sth2->rows)" to put the number of items in that array into $rv2...
BTW, why such cryptic variable names? ;-)

Of course, I may be completely off so hopefully somebody knowledgeable will
correct me on this.

good luck.

-Peter

-----Original Message-----
From: Kevin Old [mailto:kold@;carolina.rr.com]
Sent: Thursday, November 14, 2002 3:10 PM
To: [EMAIL PROTECTED]
Subject: DBD::Oracle row count not working


Hello all,

I've been using DBD::Oracle for quite some time now, but have just
noticed a major problem....I can't get the number of rows returned from
a query. Here's my code:

#db2 handle defined here


$sth2 = $dbh2->prepare($select);
$sth2->execute;
$rv2 = $sth2->rows;
print "There are $rv2 rows.";

I've used different scripts and still all I get is zero rows reported
from rows(), but plenty of data comes back.

Any ideas?

Thanks,
Kevin
--
Kevin Old <[EMAIL PROTECTED]>


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to