Re: Multiple values for IN keyword of WHERE clause don't appear to work with InfxPreparedStatement



mlapidge wrote:
Any views on the following behaviour would be appreciated. I am using

INFORMIX-OnLine 7.31.UD7
IBM Informix JDBC Driver for IBM Informix Dynamic Server 2.21.JC5

Some code....

PreparedStatement ifxStmt2 = ifxCxn.preparedStatement("select iddoc
from corrapp where identity IN (?));

This works - with only one value in the list of IN values to bind...

ifxStmt2.setString(bind, "'000000010'");

However, if I add a second value to the list of IN values (below I just
duplicate the first value and expect the same set of results) an empty
ResultSet object is returned (no exceptions raised)...

ifxStmt2.setString(bind, "'000000010','000000010");

I would not expect it to work.

? reprensents one value.

"'000000010'" which I would write as "000000010" is
one value.

"'000000010','000000010'" is one value too - just with
a comma in.

You should either:
- add the same number of ?'s as you have values
- use oldfashioned risky values directly in SQL
- redesign so you do not need it

Arne



.