Nope,

just set it directly on the statement handle
 $sth->{RaiseError} = 1
instead of on the parent $dbh

-----Original Message-----
From: Mark Dedlow [mailto:mtdedlow@;lbl.gov]
Sent: Thursday, October 24, 2002 1:06 PM
To: Dbi-Users
Subject: RaiseError sticks with statement handle??



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



Australia Post is committed to providing our customers with excellent service. If we 
can assist you in any way please either telephone 13 13 18 or visit our website 
www.auspost.com.au.

CAUTION

This e-mail and any files transmitted with it are privileged and confidential 
information intended for the use of the addressee. The confidentiality and/or 
privilege in this e-mail is not waived, lost or destroyed if it has been transmitted 
to you in error. If you have received this e-mail in error you must (a) not 
disseminate, copy or take any action in reliance on it; (b) please notify Australia 
Post immediately by return e-mail to the sender; and (c) please delete the original 
e-mail.

Reply via email to