Subject problem: PreparedStatement with "? IS NULL"
Author bullitenergy
Hello everyone!

Sorry if this question has already been asked... I could not find any
answers in Google. I also posted this question to the Dev Shed
Firebird SQL forum. The example code breaks on the prepareStatement,
probably because Jaybird or Firebird is unable to determine the type
of the third parameter:

String DELETE_A =
"DELETE FROM \"A\" WHERE \"id\" = ? AND"
+ "(\"a\" = ? OR (\"a\" IS NULL AND ? IS NULL))";
PreparedStatement ps;
ps = connection.prepareStatement(DELETE_A);
int index=1;
ps.setInt(index++, value.getId());
if(value.getA() == null) {
ps.setNull(index++, Types.INTEGER);
ps.setNull(index++, Types.INTEGER);
} else {
ps.setInt(index++, value.getA().intValue());
ps.setInt(index++, value.getA().intValue());
}
ps.executeUpdate();

Is this expected behavior? (This style of querying works in MS-SQL)
Is there some way to achieve the same effect?
I don't want to use 2 different SQL statements, because I have lots of
more columns that can have NULL values.

Thank you for your answers!
Best regards!
Bullit Energy