Possible Duplicate:
PreparedStatement IN clause alternatives?
SELECT * FROM tableName WHERE id IN ?
I wish to set the PreparedStatement's IN
parameter as an int[]
. For example, an integer
array of {1, 2, 3, 4}
would become IN (1,2,3,4)
in the query.
Is there a simple way to achieve this functionality using PreparedStatement's methods, or must I dynamically create the IN
parameter as a string by looping over the array?
I imagine something similar to #setString(int parameterIndex, String x)
but of course for an int array.