RE: Perl Issues

From: Jeremiah Wilton <jeremiah_at_ora-600.net>
Date: Thu, 21 Feb 2008 14:39:12 -0800
Message-ID: <002501c874da$95d4e870$c17eb950$@net>


JApplewhite_at_austinisd.org wrote:

> 1.  Can Exception Handling be easily done in Perl?  If so, any good
examples I can point them to?

Yes.

use DBI;
my $dbh = DBI->connect(

                        'dbi:Oracle:','', '',
                        { ora_session_mode => 2, # / as sysdba
                          PrintError => 0  #Suppresses the automatic error
reporting to STDERR
                        }

) or die "Cannot connect: $DBI::errstr\n";

my $sth = $dbh->prepare(

                        "select foo from bar"
                        ) or print "Caught an exception preparing the
cursor: $DBI::errstr\n";
print "Duh, I'm still alive! Now I can do something since I know I caught an error\n";

$dbh->disconnect;

Regards,

Jeremiah Wilton
ORA-600 Consulting
http://www.ora-600.net

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Feb 21 2008 - 16:39:12 CST

Original text of this message