my $cth = $dbh->prepare('SELECT COUNT(*) FROM SuppressList WHERE Active = ? AND ServerName = ? AND Application = ? and Instance = ?') or die "Couldn't Prepare statement: " . $dbh->errstr; $cth->execute($Active,$Server_Name,$App,$Inst); @rows = $cth->fetchrow_array(); cawto "Rows: @rows"; my ($sql, @placeholders); if (@rows ge "1") { $sql = qq{SELECT * FROM SuppressList WHERE Active = ? AND ServerName = ? AND Application = ? AND Instance = ?}; @placeholders = ($Active,$Server_Name,$App,$Inst); cawto "ServerName/App/Inst Execute Complete"; } else { $sql = qq{SELECT * FROM SuppressList WHERE Active = ? AND ServerName = ? AND Application = ?}; @placeholders = ($Active,$Server_Name,$App); cawto "ServerName/App Execute Complete"; } my $sth = $dbh->prepare($sql); $sth->execute(@placeholders);