my $query = "SELECT * FROM myTable"; $sth = $dbh->prepare($query); if(!$sth->execute()) { ... }