perldoc -f die

-----------------
Ron Reidy
Lead DBA
Array BioPharma, Inc.


-----Original Message-----
From: Sunil A.V. [mailto:[EMAIL PROTECTED]
Sent: Friday, January 07, 2005 3:31 PM
To: [email protected]
Subject: Perl should exit/abend when Oracle problems occur


Hi,

I am using perl DBI
Most of my perl code use prepared statements like this
        my $datasource = "dbi:Oracle:";


        $abdw_dbh = DBI->connect("$datasource", "$abdw_username/[EMAIL 
PROTECTED]") 
           or die "Can't connect to Oracle database: $DBI::errstr\n";


        $abdw_sql_stmt1 =  "select      AT_COST                                 
                       from             mytable 
                       where            key = ?";
        print "$abdw_sql_stmt1\n";

        ### Prepare an SQL statement for execution
        $abdw_sth1 = $abdw_dbh->prepare($abdw_sql_stmt1);

        $abdw_sth1->execute();
        $abdw_sth1->bind_columns( undef, \$hsh_loop_loc, \$hsh_loop_loc_typ);
        while ($abdw_sth7->fetch() )  {
                $hshLocTypes{$hsh_loop_loc} = $hsh_loop_loc_typ;
        }
        
But my database abdw does go to maintenance many times. So my perl code at 
those times will wait till the database problems get right. 
What I want is when there is some db problems [even for that matter when tables 
are locked by some other user for long time] then
my perl code should exit to calling program with say a exitcode of 1. Is there 
any way in code to handle this.

Thanks,
Sunil  

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.

Reply via email to