Equality and inequality expressions
return the result of an equality comparison of its operands.
Expression
|
Character representation
|
Returns
|
Equality
|
== eq
|
True (1) when both operands compare identically,
and false (0) if they do not compare identically.
|
Inequality
|
<> ne
|
True (1) when both operands do not compare
identically, and false (0) if they compare identically.
|
The following special cases also apply when using equality operators:
If either operand is null, a null comparison is performed.
Null-valued operands compare identically whenever both operands
are null, and compare differently whenever one operand is not null.
If both operands are references, both operands compare identically
when they both refer to the same object, and compare differently
when they do not refer to the same object.
If both operands are string valued, a locale-sensitive lexicographic
string comparison is performed on the operands. Otherwise, if they
are not both null, the operands are promoted to numeric values,
and a numeric comparison is performed.
These are examples of using the equality and inequality expressions:
Expression
|
Returns
|
3 == 3
|
1 (true)
|
3 <> 4
|
1 (true)
|
"abc" eq "def"
|
0 (false)
|
"def" ne "abc"
|
1 (true)
|
5 + 5 == 10
|
1 (true)
|
5 + 5 <> "10"
|
0 (false)
|
|
|
|