Subject Re: problem: PreparedStatement with "? IS NULL"
Author mailmur
> with one parameter assignment makes more sense than
> WHERE column = ? OR (column IS NULL AND ? IS NULL)

> I found out that i can workaround by using:
> WHERE column = ? OR (column IS NULL AND ? = 0)

I've always found this a limitation of SQL to handle null values/real
values in a query.
This is update query and looks consistent:
Update Table Set field='xxx' where id=1;
Update Table Set field=null where id=1;

This is not consistent format for select query:
Select * from Table where field='xxx';
Select * from Table where field Is Null;
//select * from Table where field=null; // <- why not this work??

Now, generating such select queries produce unnecessary if-then-else
source code to handle null value.

Another limitation is a list handling with in format.
Select * from Table where field In ('xxx', 'yyy', 'zzz');

I don't know how to support this query with a preparedstatement if
list can have 1...n values at runtime.