my $sth = prepare_and execute($dbh, " SELECT cols FROM ".$dbh->quote_identifier($tableName)." WHERE col=constant AND col2=constant "); while (my $row = $sth->fetchrow_hashref) { ... }