IBM DB2 - Prepared Statement problem with '? is NULL'
843854Jul 11 2005 — edited Jul 11 2005Hi,
I just started to use DB2 and I wanted to move some SQL statements that I was using in Oracle (and tested in MySQL).
SELECT t.id FROM table t WHERE
((? is NULL) OR (t.id=?))
Prepared statement:
ps.setString(1, (String)null);
It looks like '? is NULL' doesn't work with DB2, does anyone had this problem before and do you know how this can be fixed?
I'm getting this error SQLCODE: -418, SQLSTATE: 42610, SQLERRMC: null. and my driver is com.ibm.db2.jcc.DB2Driver (db2jcc.jar)
Thanks