Oracle 5.0 Reference Manual page 916

Table of Contents

Advertisement

Name
[898]
NOT LIKE
[898]
STRCMP()
If a string function is given a binary string as an argument, the resulting string is also a binary string. A
number converted to a string is treated as a binary string. This affects only comparisons.
Normally, if any expression in a string comparison is case sensitive, the comparison is performed in
case-sensitive fashion.
expr LIKE pat [ESCAPE 'escape_char']
Pattern matching using SQL simple regular expression comparison. Returns
If either
or
expr
pat
The pattern need not be a literal string. For example, it can be specified as a string expression or
table column.
Per the SQL standard,
results different from the
mysql>
SELECT 'ä' LIKE 'ae' COLLATE latin1_german2_ci;
+-----------------------------------------+
| 'ä' LIKE 'ae' COLLATE latin1_german2_ci |
+-----------------------------------------+
|
+-----------------------------------------+
mysql>
SELECT 'ä' = 'ae' COLLATE latin1_german2_ci;
+--------------------------------------+
| 'ä' = 'ae' COLLATE latin1_german2_ci |
+--------------------------------------+
|
+--------------------------------------+
In particular, trailing spaces are significant, which is not true for
performed with the
=
mysql>
SELECT 'a' = 'a ', 'a' LIKE 'a ';
+------------+---------------+
| 'a' = 'a ' | 'a' LIKE 'a ' |
+------------+---------------+
|
1 |
+------------+---------------+
1 row in set (0.00 sec)
With
[896]
you can use the following two wildcard characters in the pattern.
LIKE
Character
%
_
mysql>
SELECT 'David!' LIKE 'David_';
-> 1
mysql>
SELECT 'David!' LIKE '%D%v%';
-> 1
To test for literal instances of a wildcard character, precede it by the escape character. If you do not
specify the
ESCAPE
String
\%
\_
String Comparison Functions
Description
Negation of simple pattern matching
Compare two strings
is NULL, the result is NULL.
[896]
performs matching on a per-character basis, thus it can produce
LIKE
[875]
comparison operator:
=
1 |
[875]
operator:
0 |
Description
Matches any number of characters, even zero characters
Matches exactly one character
character, "\" is assumed.
Description
Matches one "%" character
Matches one "_" character
896
[896]
0 |
CHAR
(TRUE) or
(FALSE).
1
0
or
comparisons
VARCHAR

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents