Perl / DBH

Discussion in 'Perl Misc' started by The Magnet, Aug 14, 2009.

  1. The Magnet

    The Magnet Guest

    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!
     
    The Magnet, Aug 14, 2009
    #1
    1. Advertising

  2. The Magnet

    J. Gleixner Guest

    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;
     
    J. Gleixner, Aug 14, 2009
    #2
    1. Advertising

  3. 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
     
    Xho Jingleheimerschmidt, Aug 15, 2009
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Scott Lander
    Replies:
    0
    Views:
    3,718
    Scott Lander
    Jul 11, 2003
  2. Ravi
    Replies:
    6
    Views:
    474
    Kris Wempa
    Oct 1, 2003
  3. dpackwood
    Replies:
    3
    Views:
    1,860
  4. Julia deSilva

    $dbh->tables() returns nothing

    Julia deSilva, Dec 17, 2003, in forum: Perl Misc
    Replies:
    3
    Views:
    126
    Bryan Castillo
    Dec 18, 2003
  5. PerlFAQ Server

    FAQ 1.4 What are Perl 4, Perl 5, or Perl 6?

    PerlFAQ Server, Jan 23, 2011, in forum: Perl Misc
    Replies:
    0
    Views:
    331
    PerlFAQ Server
    Jan 23, 2011
Loading...

Share This Page