On 2014-07-20, 5:07 PM, Donald Shepherd wrote:
Is it possible to have a variable number of parameters in an IN clause in a
prepared statement, i.e. "select * from Table where Col1 in (?,?,?,...);"?
Or do I need a constant number of parameters in there to be able to re-use
the prepared statement?

If it were possible, the best way to do that design-wise would be to have a single parameter which was array-typed or relation-typed and then do a join on it, like this:

  select x.* from Table as x inner join ? as y using (Col1)

Otherwise, the closest thing would be to stuff the parameters in a temporary table and then use that for the join in a subsequent select.

-- Darren Duncan

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to