The LIKE operator allows pattern matching to be performed. The NOT LIKE operation does the same, but matches records without the pattern.
The argument string for LIKE can contain any characters except for two special characters: _ (underscore) and % (percent). These characters only match themselves (the CAPS=NO/SEARCH rules are honored).
The special characters obey the following rules:
These special characters can be used as many times as required in a search string. Some examples follow:
Matches only records with ABC in the field.
Matches on values starting with ABC
As above, but at least one character must follow ABC
Matches fields ending in XYZ
Matches fields with mmm somewhere in them
Matches a field containing the strings FRED and BLOGGS in that order, with at least one character between them
Matches a field exactly 3 characters long
Matches a field at least 5 characters long, with XY in columns 3 and 4
It is evident that LIKE is a powerful operator and consequently can use significant CPU resources.
The first two examples in this table can also be done using keys. LIKE attempts to use keys to fully or partially (whenever a LIKE argument has non-special leading characters) determine matching records.
| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |