RaiseError appears to be saved per statement handle and not changeable for
the execution of a given statement once the statement has been prepared.
Here's an example:
$dbh = DBI->connect("dbi:Oracle:$db", $user, $pw, {PrintError=>0});
# before prepare, set RaiseError "off"
$dbh->{RaiseError} = 0;
$sth = $dbh->prepare('select 1 from dual where sysdate = ?');
# now set RaiseError "on"
$dbh->{RaiseError} = 1;
eval {
$sth->execute('junk') ; # will raise 01858 trying to cast "junk" to
DATE
die "DBI failed to die!!"; # should not be seen if DBI die'ed
};
print "-->$@\n";
print "DBI error was: $DBI::errstr \n";
This outputs:
-->DBI failed to die!! at location.pl line 22.
DBI error was: ORA-01858: a non-numeric character was found where a [...]
As this illustrates, DBI did not die(), however, an exception was
in fact raised by Oracle, as is illustrated by $DBI::errstr.
The converse is also the case, i.e. if RaiseError is "on" when I prepare
the statement, then I cannot turn it off.
This is Oracle 8.1.7.1 and the behavior is the same with 5.6 and 5.8.
DBI 1.12, DBD::Oracle 1.03.
What up?
Thanks