Perl / DBH

T

The Magnet

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

J. Gleixner

The said:
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;
 
X

Xho Jingleheimerschmidt

The said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top