in reply to DB2 checking for an error on select

Set RaiseError to 1 to see whether bind_col() or fetch() failed.

(And as a side note, I would recommend not to change RaiseError back to 0. It just make things easier. You don't have to check for errors, and when you expect that something may go wrong, you just add an eval { BLOCK }.)

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^2: DB2 checking for an error on select
by morgon (Priest) on May 11, 2009 at 21:50 UTC
    I would recommend not to change RaiseError back to 0. It just make things easier.
    That depends.

    For one-off scripts it certainly makes things easier, however when you write larger applications you almost certainly want to raise your own exceptions so you can then catch them by type (using Exception::Class or something similar - "Perl best practices" has a chapter on it) and then you are better off doing something like

    $sth->execute or MyApp::DBException( error => $sth->errstr )->throw;
    rather than using RaiseError.