Where you say "WHERE custnum == ?", there ought to be only one equals sign.
Ted Behling -----Original Message----- From: John [mailto:[EMAIL PROTECTED] Sent: Sunday, December 11, 2005 12:40 AM To: dbi-users@perl.org Subject: select placeholder Hi Can anyone see the error in the following code. It has to do with the placeholder in the select statement. Substitution fails to occur at the "$sth1->execute..." statement script dies at "while (my $rowref...". If I replace the placeholder with a literal it works as expected. [code] # # open database # my $dbh = DBI->connect("dbi:SQLite:$db1","","") or die "couldn't connect to database: " . DBI->errstr; # # sql statements # my $st1 = "SELECT * FROM a1 WHERE custnum == ?"; my $sth1 = $dbh->prepare($st1) or die "couldn't prepare... " . DBI->errstr; my ($asset, $custnum, $branch, $customer, $address, $town, $postcode); my ($line, $aline, $cline, @assets, @customers, @lines, @cust2, @unigas); my ($done, $record, @records, %seen, $cnt, $ii, $best, @updates); # # build list of duplicate details # #while (not defined $done) { $custnum = shift @duplist; redo if int($custnum) == 0; $sth1->execute($custnum) or die "couldn't execute... " . DBI->errstr; while (my $rowref = $sth1->fetchrow_arrayref) { ($asset, $custnum, $branch, $customer, $address, $town, $postcode) = @$rowref; [/code] -- Regards John McMahon <[EMAIL PROTECTED]>