HCL
OneDB™ products
support ASCII characters as wildcard characters in the MATCHES and
LIKE conditions.
HCL
OneDB products
support the following ASCII characters as wildcard characters:
Condition |
Wildcard characters |
LIKE |
_ % |
MATCHES |
* ? [ ] ^ - |
For CHAR and VARCHAR data, the database server performs
byte-by-byte comparison for pattern matching in the LIKE and MATCHES
conditions. For NCHAR and NVARCHAR data, the database server performs
pattern matching in the LIKE and MATCHES conditions based on logical
characters, not bytes. Therefore, the underscore ( _ ) wildcard of
the LIKE clause and the ? (question mark) wildcard of the MATCHES
clause match any one single-byte or multibyte character, as the following
table shows.
Condition |
Quoted string |
Column value |
Result |
LIKE |
'ab_d' |
'abcd' |
True |
LIKE |
'ab_d' |
'abA1A2d' |
True |
MATCHES |
'ab?d' |
'abcd' |
True |
MATCHES |
'ab?d' |
'abA1A2d' |
True |
The database server treats any multibyte character
as a literal character. To tell the database server to interpret a
wildcard character as its literal meaning, you must precede the character
with an escape character. You must use single-byte characters as escape
characters; the database server does not recognize use of multibyte
characters for this purpose. The default escape character is the backslash
(\) symbol.
The following MATCHES condition returns a
TRUE
result
for the column value that is shown.
Condition |
Quoted string |
Column value |
Result |
MATCHES |
'ab\?d' |
'ab?d' |
True |