in reply to DBI qw(:sql_types) with placeholders versus SQLite3
Hi,
You can't stuff multiple values for IN into a single placeholder. You need one for each. Try something like this:
... or this ...my $query = sprintf('SELECT recno, body FROM body WHERE recno IN (%s)' +, join ',', map {$_ = '?'} @recnos); ... $sth->execute(@recnos);
my $query = sprintf('SELECT recno, body FROM body WHERE recno IN (%s)' +, join ',', ('?') x @recnos); ... $sth->execute(@recnos);
Hope this helps!
Update: added second example
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: DBI qw(:sql_types) with placeholders versus SQLite3
by mldvx4 (Hermit) on Mar 31, 2024 at 04:39 UTC | |
by hippo (Archbishop) on Mar 31, 2024 at 17:01 UTC | |
by mldvx4 (Hermit) on Apr 01, 2024 at 11:04 UTC |