You're selecting every record from the table that does not match the number you're looking at. That doesn't tell you whether the number is in the table. I'm guessing you want something like this:
my $sth = $dbh->prepare( 'SELECT count(*) FROM num_table WHERE num = ? +' ); foreach my $n ( @num_from_doc ) { $sth->execute( $n ); my ($exists) = $sth->fetchrow_array; my $not = $exists ? '' : ' not'; print "Number $n is$not in the database.\n"; }
In reply to Re: Compare items in DB
by kyle
in thread Compare items in DB
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |