in reply to sql bind parameterization clarity

For IN, I use something like:

my $placeholders = join ",", (('?') x @values); my $sth = $dbh->prepare(" SELECT * FROM table WHERE field IN ($placeholders) ") or die $dbh->err +str; $sth->execute(@values);

Replies are listed 'Best First'.
Re^2: sql bind parameterization clarity
by erix (Prior) on Aug 26, 2022 at 20:02 UTC

    -- for postgres you can simplify that a bit by where field = any ( ? ) -- followed by $sth->execute(\@values) -- note the backslash

Re^2: sql bind parameterization clarity
by djlerman (Beadle) on Sep 01, 2022 at 15:39 UTC
    Thank You.