Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   Perl / DBH (http://www.velocityreviews.com/forums/t911211-perl-dbh.html)

The Magnet 08-14-2009 02:52 PM

Perl / DBH
 

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!

J. Gleixner 08-14-2009 04:07 PM

Re: Perl / DBH
 
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;

Xho Jingleheimerschmidt 08-15-2009 02:16 AM

Re: Perl / DBH
 
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


All times are GMT. The time now is 11:14 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.