$sth->execute(); my $recordset = $sth->fetchall_arrayref(); if (@$recordset) { # there are records. Do something here } else { # empty recordset. Do something else. }