Subject Re: [Firebird-Java] PreparedStatement with LIKE ? extremly slow
Author Carsten Schäfer
What values should be used for 1= ? and 2 = ? ???
'2005-0119849- 8' ???
Then i get a org.firebirdsql.jdbc.field.TypeConvertionException: Error
converting to int
Exception.

mfg
Carsten

Roman Rokytskyy schrieb:
>
> > 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.
>
> _