Susan, this is all explained in the excellent DBI perldocs which you can view by doing
perldoc DBI at a command prompt. Look for the section titled "Transactions". There's also website "www.perldoc.com" but it doesn't seem to be responding at the moment :-( Anyone know what's wrong with that site? HTH. Hardy Merrill >>> "Reidy, Ron" <[EMAIL PROTECTED]> 02/24/05 8:55 AM >>> Wrap your calls in an eval block. $dbh = DBI->connect(...); eval { $sth = $sbh->prepare("select * from mytable"); $sth->execute; ... }; if ($@) { # an error occured print $@; # other actions } -- Ron Reidy Lead DBA Array BioPharma. Inc. -----Original Message----- From: susan lam [mailto:[EMAIL PROTECTED] Sent: Thu 2/24/2005 6:08 AM To: dbi-users@perl.org Cc: Subject: Oracle error handling Hi, I'm new to perl. I apologize if this is not the right place to post newbie questions. If mytable does not exist, I would like to trap the Oracle error message and write the message to an Oracle table. I know how to write to a table but I do not know how to trap the message. $dbh = DBI->connect("dbi:Oracle:mydb",scott,tiger,{RaiseError => 1, AutoCommit => 0}) || die "Database connection failed: $DBI::errstr"; $sql = qq {select * from mytable}; $sth = $dbh->prepare($sql); $sth->execute; $dbh->disconnect; Also, if mytable does exist, how can I obtain the row count returned from the above query and assign it to a variable? I appreciate any help I can get. thanks. susan __________________________________ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail This electronic message transmission is a PRIVATE communication which contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. Please notify the sender of the delivery error by replying to this message, or notify us by telephone (877-633-2436, ext. 0), and then delete it from your system.