Differences between LIKE and equal (=) comparisons When you use locale-based collation, the comparisons can return different results when you use the LIKE and equal (=) operators. collationLIKE and equal (=) comparisons LIKE comparisonscollation and equal (=) comparisonscollation and

For example, suppose that the database is set to use a locale where the character 'z' has the same collation elements as 'xy'. Consider the following two WHERE clauses:

  1. WHERE 'zcb' = 'xycb'
  2. WHERE 'zcb' LIKE 'xy_b'

For WHERE clause 1, returns TRUE, because the collation elements for the entire string 'zcb' will match the collation elements of the entire string 'xycb'.

For WHERE clause 2, returns FALSE, because the collation element for the character 'z' does not match the collation element for the character 'x'. In addition, when a metacharacter such as an underscore is used with the LIKE operator, the metacharacter counts for one character in the string value. A clause such as WHERE 'xycb' LIKE '_cb' returns FALSE, because 'x' is compared to the metacharacter '_' and 'y' does not match 'c'.