# Unknown parameter

'The situation is similar to those described above when a column is compared using the LIKE operator to a parameter whose value is unknown in advance (dynamic parameter, join column, etc.).

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.
Note: 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 ?

Parent topic: LIKE transformations
Related reference
Character string beginning with constant
Character string without wildcards