In this situation, the LIKE predicate is likewise transformed into
three predicates: one LIKE predicate, one predicate using the
>= operator, and one predicate using the
< operator. For example,
country LIKE ?
is transformed into
country LIKE ?
AND country >= InternallyGeneratedParameter
AND country < InternallyGeneratedParameter
where the InternallyGeneratedParameters are calculated at the
beginning of execution based on the value of the parameter.
This transformation can lead to a bad plan if the user passes in a
string that begins with a wildcard or a nonselective string as the parameter.
Users can work around this possibility by writing the query like this (which
is not optimizable):
(country || '') LIKE ?