DBI 1.14
DBD::Oracle ?
Oracle 8.0.5
Setting RaiseError to 0 doesn't seem to work in some cases. If the wrong number
of bind parameters are used the error is not caught by the if statement in the
code below. If no bind parameters are used then the error is caught as
expected. It doesn't seem to make any difference whether RaiseError is set to 0
with the sth or at connection.
I was trying to do $sth->{RaiseError} = 0 before one section to display more
information on the error but it doesn't seem to work. The following simplified
code demonstrates the problem.
Code:
use DBI;
my($dbh) = DBI->connect("dbi:Oracle:bio0_ipc", "XXXX", "XXXX",
{RaiseError=>0, PrintError=>0, AutoCommit=>0});
my($sth) = $dbh->prepare(qq{SELECT * FROM DNA_transfer_experiment WHERE id = ?
or id = ?});
#$sth->{RaiseError} = 0;
# the following if works as expected
if (! $sth->execute() ) {
print "Found error\n";
}
# the following if produces the error
# execute called with 3 bind variables when 2 are needed at ./tmp line 15.
# instead of printing my line
if (! $sth->execute("1", "2", "3") ) {
print "Found error with bind variables\n";
}
$sth->{RaiseError} = 1;
$dbh->disconnect;
exit;
Thanks in advance,
Belinda