Thanks to all who responded. This has been a valuable and educational
interchange for me. Since I don't have much control over the number of
items in the set, I've decided to load them into a table for simplicity.
Thanks again,
Jim.
Jim Lynch wrote:
>
> I've tried everything except standing on my head to get it to work.
> This example should show what I'm attempting to do. As long as the
> clause has only one element, it works.
>
> my $in_clause1="('abcdef','xzyrst')";
> my $in_clause2="('abcdef')";
>
> sth=$db->prepare("select * from table_x where txt in ?");
> $sth->execute($in_clause1);
> # that works
> $sth->execute($in_clause);
> # this doesn't
> I've tried also tried
>
> my $in_clause1="'abcdef','xzyrst'";
> my $in_clause2="'abcdef'";
>
> sth=$db->prepare("select * from table_x where txt in (?)");
>
> and gotten the same results. Can someone please tell me if it's
> possible to generate an IN clause on the fly and how?
>
> Thanks,
> Jim.