fetchrow_array warning and error in cleanup
am 04.01.2008 10:13:52 von Kees.COUPRIE=20
Happy New Year to you all,
I am quite new to using DBI and am running into something odd.
I'm using Perl 5.6.0 build 623 (Activestate), DBI 1.48 and DBD-ORACLE
1.12 on a Windows XP box. Not exactly the newest versions, I know, but
the company I work for is quite paranoid when it comes to using "new"
software, so I'm afraid that I'm stuck with these versions.
On my PC I have installed Oracle Client 10.1 and I am connecting to a
database server running Oracle 10g. The connection works fine and I can
perform queries.
So far so good. The issue is that at the end of each query, after that
last record has been fetched, I get the following warning:
DBD::Oracle::st fetchrow_array warning: (err=3D0, errstr=3Dundef,
state=3Dundef) at C:\
Then at the very end of the script, even after the disconnect, I get:
(in cleanup) Can't call method "FETCH" on an undefined value at
C:/Perl/site/lib/Win32/TieRegistry.pm line 1486 during global
destruction.
Stripped down to the bare minimum the script looks like this:
use DBI;
=20
my $datasource =3D "dbi:Oracle:mydatabase";
$user=3D'myuser';
$password=3D'mypassword';
=20
$dbh =3D DBI->connect($datasource, $user, $password) or die =
"Couldn't
connect to database: " . DBI->errstr;
=20
$sql =3D q{
SELECT col_a, col_b
from mytable
};
=20
$sth =3D $dbh->prepare($sql);
=20
$sth -> execute;
=20
while (my @results =3D $sth->fetchrow_array()) {
print "$results[0], $results[1]\n";=20
}
=20
$sth->finish;
=20
$dbh->disconnect;
I'm lost. The database connection and queries seem to be working fine,
but the warnings are extremely annoying.
Any help would be highly appreciated.
Best regards,
Kees Couprie