According to the SQL standard, if the column is NULL, a search condition is to check if the NULL value is "column IS NULL". If the column is not null, you can have a condition such as "column = 'blabla". To make parameter markers work in both cases, modify the statement as follows:
SELECT FOO FROM BAR WHERE COALESCE(FOOBAR, 'a') = ? "
and have the following code:
if(<condition>) preparedStatement.setString(1, "<string value>"); else preparedStatement.setString(1, "a");
No matter what @Mark suggested, I did not work for me in Oracle.
source share