This is an archived low-energy page for bots and other anonmyous visitors.
Please sign up if you are a human and want to interact.
ctaustin has asked for the wisdom of the Perl Monks concerning the following question:
I am using the dbi module to connect to an oracle database. The goal is to perform some updates on a couple of different tables via a webpage, when complete I would like to display the number of records that were updated for each table, much the same way that sqlplus does (i.e. 412 records updated).
Is there a way to capture this value?
Thanks. Tony
Re: count of records updated
by Cine (Friar) on Jul 17, 2002 at 08:51 UTC
|
According to DBD::mysql you can use $sth->rows, not that I've ever tried... I dont know about DBD::Oracle however.
T
I
M
T
O
W
T
D
I | [reply] |
Re: count of records updated
by amphiplex (Monk) on Jul 17, 2002 at 08:53 UTC
|
if $sth is your executed sql statement, you can get the number of records affected via $sth->rows. (using Oracle at least)
---- amphiplex | [reply] |
Re: count of records updated
by Abigail-II (Bishop) on Jul 17, 2002 at 08:57 UTC
|
If the number of rows affected is known,
then for non-select actions, the execute
method will return the number of affected rows. But the
driver (and hence the DBI), can only do that if the database
is returning this information. You can also call the
method rows on the statement handle to get
the result from the last execute.
You will have to write the code to sum the results from the
various executes yourself, but that shouldn't
be too hard.
Abigail | [reply] [d/l] [select] |
|