How do I parameterize a SQL IN clause?
I want to parameterize the arguments in the IN clause. I know how to parameterize the "search" field:
SELECT * FROM tbl WHERE ? IN (1,2,3);
But how can I parameterize the arguments to IN without knowing how many there are?
SELECT * FROM tbl WHERE column IN (?)
only allows one parameter to be passed to execution.
See this answer
In CUBRID, the IN operator is defined as argument IN collection.
To parameterize the whole IN clause you can write:
SELECT * FROM tbl WHERE column IN ?
To parameterize only certain elements of the IN clause you can write:
SELECT * FROM tbl WHERE column IN (1, ?, 2, ?, ?)