Subject Re: [Firebird-Java] PreparedStatement with LIKE ? extremly slow
Author Roman Rokytskyy
> Of cause sometimes i use wildcards in this query.
> That's the reason i use like instead of =.

The only solution would be to use more complicated predicate, something
like:

WHERE (1 = ? AND f_liefer_nr = ?) OR (2 = ? AND f_liefer_nr LIKE ?)

Note, you can't use "? = NULL" here, since Firebird won't be able to
determine type of the variable and you will get exception during prepare.

Roman

P.S. I did not test this statement, so you have to check how the
optimizer will behave.