my $sql="Select Count(*) From ClearTransferData Where AccountNo = ? and TransferFlag = ? and TransferType = ? and RejectType = ? and AdpNumber = ? and Shares = ? and ProcessingDate = ? "; my $sth = $dbh->prepare($sql) or die $dbh->errstr; $sth->execute(@data); # Fetch results with $sth->fetchrow_array(), or whatever $sth->disconnect();