my %kpi_thres = ( "PDP"=>80, "GAS"=>70, "RAU"=>75 ); $SQL=qq{select * from abc where date=?}; foreach $kpi (keys(%kpi_thres)) { my $sth_ne = $dbh->prepare_cached($SQL); $sth_ne->execute($currDateTime); }