On 04/02/14 19:36, David Nicol wrote:
$price_sth->execute;
my ($o_file_price) = $price_sth->fetchrow_array();
if ($price_sth->fetch) {
$this->log_error('ERROR: scalar select returned second row at
%s line %d', __FILE__, __LINE__);
}
I expected the fetch to return undef, but it throws an Oracle error.
My best ignorant guess here is that fetchrow_array does some cleanup
on one-row datasets, but that isn't documented.
Advise?
That is in deed interesting. When I run the following with DBD::ODBC to MS SQL
Server:
use strict;
use warnings;
use DBI;
my $h = DBI->connect();
eval {
$h->do(q/drop table mje/);
};
$h->do(q/create table mje (a int)/);
my $s = $h->prepare(q/insert into mje values(?)/);
$s->execute(1);
$s->execute(2);
$s = $h->prepare(q/select * from mje where a = 1/);
$s->execute;
my ($row) = $s->fetchrow_array;
print "$row\n";
$row = $s->fetch;
print "$row\n";
I get:
1
Use of uninitialized value $row in concatenation (.) or string at
mje/fetch_off_end.pl line 20.
However, I get the same with DBD::Oracle so how is you code different from the
above.
Martin