As moritz suggested, using exceptions can simplify your logic:
Also, please use placeholders!$dbh->{RaiseError} = 1; # only need to do this once ... eval { my $sth = $dbh->prepare(...); $sth->execute(...); }; if ($@) { # unable to insert, error message is in $@ ... }
In reply to Re: Capturing SQL errors in Perl
by pc88mxer
in thread Capturing SQL errors in Perl
by Red_Dragon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |