Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Perl / DBH

Reply
Thread Tools

Perl / DBH

 
 
The Magnet
Guest
Posts: n/a
 
      08-14-2009

Hi,

I cannot seem to get Oracle to return any status codes to Perl I have
the following line:

$dbh->do("BEGIN load_story_prc('$name','$formattedtime'); END;");
if ($@) { warn "Database error on $name: $DBI::errstr\n"; }

But I never get anything back. Ideally I'd like to get the ORA- error
message if there is any.....

Can anyone help?

Many thanks!
 
Reply With Quote
 
 
 
 
J. Gleixner
Guest
Posts: n/a
 
      08-14-2009
The Magnet wrote:
> Hi,
>
> I cannot seem to get Oracle to return any status codes to Perl I have
> the following line:
>
> $dbh->do("BEGIN load_story_prc('$name','$formattedtime'); END;");
> if ($@) { warn "Database error on $name: $DBI::errstr\n"; }
>
> But I never get anything back. Ideally I'd like to get the ORA- error
> message if there is any.....


Because the error isn't stored in $@.

>
> Can anyone help?


Is anything in $dbh->errstr?

$rows = $dbh->do($statement) or die $dbh->errstr;
 
Reply With Quote
 
 
 
 
Xho Jingleheimerschmidt
Guest
Posts: n/a
 
      08-15-2009
The Magnet wrote:
> Hi,
>
> I cannot seem to get Oracle to return any status codes to Perl I have
> the following line:
>
> $dbh->do("BEGIN load_story_prc('$name','$formattedtime'); END;");
> if ($@) { warn "Database error on $name: $DBI::errstr\n"; }
>
> But I never get anything back. Ideally I'd like to get the ORA- error
> message if there is any.....
>
> Can anyone help?


If you are activating RaiseError, then the $dbh->do needs to be put in
an eval{...}, oherwise it won't survive to reach test $@. And if you
are not setting RaiseError and using eval{}, then there is no reason
for $@ to ever get set, whether there is an error or not.



Xho
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FAQ 1.4 What are Perl 4, Perl 5, or Perl 6? PerlFAQ Server Perl Misc 0 01-23-2011 05:00 AM
$dbh->tables() returns nothing Julia deSilva Perl Misc 3 12-18-2003 07:39 PM
problem with $dbh->execute in a For loop Ravi Perl 6 10-01-2003 05:15 PM
Perl Help - Windows Perl script accessing a Unix perl Script dpackwood Perl 3 09-30-2003 02:56 AM
Re: how to select rows with $dbh->do($sql) Scott Lander Perl 0 07-11-2003 01:26 PM



Advertisments