In the query language, only values of the same type can be compared. However, this rule has one exception: Exact and approximate numeric values can be compared. In such a comparison, the required type conversion adheres to the rules of Java numeric promotion.
The query language treats compared values as if they were Java types and not as if they represented types in the underlying data store. For example, a persistent field that could be either an integer or a NULL must be designated as an Integer object and not as an int primitive. This designation is required because a Java object can be NULL, but a primitive cannot.
Two strings are equal only if they contain the same sequence of characters. Trailing blanks are significant; for example, the strings 'abc' and 'abc ' are not equal.
Two entities of the same abstract schema type are equal only if their primary keys have the same value. Table 22–9 shows the operator logic of a negation, and Table 22–10 shows the truth values of conditional tests.
Table 22–9 NOT Operator Logic
NOT Value |
Value |
---|---|
T |
F |
F |
T |
U |
U |
Table 22–10 Conditional Test
Conditional Test |
T |
F |
U |
---|---|---|---|
Expression IS TRUE |
T |
F |
F |
Expression IS FALSE |
F |
T |
F |
Expression is unknown |
F |
F |
T |