Re: Multiple values for IN keyword of WHERE clause don't appear to work with InfxPreparedStatement
- From: "mlapidge" <mlapidge@xxxxxxxxxxx>
- Date: 4 Sep 2006 12:02:24 -0700
Thanks Arne,
I tested with your reply in mind and now I know what the problem is I
can get on and fix it.
Arne Vajhøj wrote:
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
.
- References:
- Prev by Date: Re: Multiple values for IN keyword of WHERE clause don't appear to work with InfxPreparedStatement
- Next by Date: JDBC to MS Access
- Previous by thread: Re: Multiple values for IN keyword of WHERE clause don't appear to work with InfxPreparedStatement
- Next by thread: Re: Limiting Large Result Sets
- Index(es):
Relevant Pages
|
|