Another way to construct a reasonable "IN" clause is to use the
DBI::quote method:

| my @vals = ('foo', "bar", "baz's");
| my $set  = join ', ', map $dbh->quote($_), @vals;
| my $sql  = "SELECT whatever FROM wherever WHERE somecolumn IN ($set)";

Note that this will properly handle the single quote in the third
value.

Using multiple placeholders will also work, although I'd be surprised
if the total number of placeholders in any given statement can be all
that high.

Finally, consider other ways of solving the problem.  Are you using
this set often?  If so, consider putting it into a table in the
database, and use a subquery to generate the IN clause, or join
against the primary table.

t.

Reply via email to