my $tmp_query="insert into values('','');"; eval { $sth = $dbh->prepare($tmp_query); $sth->execute(); $sth->finish(); }; if ($@) { # error... } #### $sth = $dbh->prepare($tmp_query); if (!$sth) { die "Error:" . $dbh->errstr . "\n"; } if (!$sth->execute) { die "Error:" . $sth->errstr . "\n"; } ...