The % and _ characters may be used in any combination in pattern_expression.
Character | Description |
---|---|
% (PERCENT SIGN) | Represents any string of zero or more arbitrary characters. Any string of characters is acceptable as a replacement for the percent. |
_ (LOW LINE) | Represents exactly one arbitrary character. Any single character is acceptable in the position in which the underscore character appears. |
The underscore and percent characters cannot be used in a pattern. To get around this, specify a single escape character in addition to pattern_expression. For details, see ESCAPE Feature of LIKE.
The following table describes how the metacharacters % and _ (and their fullwidth equivalents) behave when matching strings for various server character sets. Note that ANSI only defines the single byte spacing underscore and percent sign metacharacters.
Teradata SQL extends the permissible metacharacter set for the LIKE predicate to include the fullwidth underscore and the fullwidth percent sign.
FOR this server character set … | USE this metacharacter … | TO match this character or characters … | |
---|---|---|---|
ANSI Mode | Teradata Mode | ||
KANJI1 | spacing underscore | any one single- or multibyte character. | any one single byte character. |
fullwidth spacing underscore | any one single byte character or multibyte character. | any one single byte character or multibyte character. | |
percent sign | any sequence of single or multibyte characters. | any sequence of single byte characters or multibyte characters. | |
fullwidth percent sign | any sequence of single or multibyte characters. | any sequence of single byte characters or multibyte characters. | |
UNICODE LATIN KANJISJIS |
fullwidth spacing underscore | none. These characters are not treated as metacharacters in order to maintain compliance with the ANSI SQL standard. |
|
fullwidth percent | |||
GRAPHIC | fullwidth spacing underscore | any one single GRAPHIC character. | |
fullwidth percent sign | any sequence of GRAPHIC characters. |