The rules are troublesome and not easy to find them.
But, they were clearly described in
"DB2 SQL Reference Volume 1" ---> Chapter 2. Language elements ---> Assignments and comparisons --->
Quote:
Numeric comparisons
Numbers are compared algebraically; that is, with regard to sign. For example, −2 is less than +1.
If one number is an integer and the other is decimal, the comparison is made with a temporary copy of the integer, which has been converted to decimal.
When decimal numbers with different scales are compared, the comparison is made with a temporary copy of one of the numbers that has been extended with trailing zeros so that its fractional part has the same number of digits as the other number.
If one number is floating-point and the other is integer or decimal, the comparison is made with a temporary copy of the other number, which has been converted to double-precision floating-point.
Two floating-point numbers are equal only if the bit configurations of their normalized forms are identical.
|
So, the comparison must be done by decimal in your case.