Derby, at least, does not like this. One solution would need to cast the test expression, i.e., "... where cast(? as VARCHAR) in (?,?)"