![]() Previous |
![]() Next |
When you compare text data, you must specify the text exactly as it appears, with punctuation, spaces, and uppercase or lowercase letters. A text literal must be enclosed in single quotes. For example, this expression tests whether the first letter of each employee's name is greater than the letter "M."
EXTCHARS(employee.name, 1, 1) GT 'M'
You can compare TEXT
and ID
values, but they can only be equal when they are the same length. When you test whether a text value is greater or less than another, the ordering is based on the setting of the NLS_SORT option.
You can compare numbers with text by first converting the number to text. Ordering is based on the values of the characters. This can produce unexpected results because the text is evaluated from left to right. For example, the text literal 1234
is greater than 100,999.00
because 2
, the second character in the first text literal, is greater than 0
, the second character in the second text literal.
Suppose name.label
is an ID
variable whose value is 3-Person
and name.desc
is a TEXT
variable whose value is 3-Person Tents
.
The result of the following SHOW
statement is NO
.
SHOW name.desc EQ name.label
The result of the following statements is YES
.
name.desc = '3-Person' SHOW name.desc EQ name.label