![]() Previous |
![]() Next |
When you get unexpected results when comparing numeric data, then there are several possible causes to consider:
A number you are comparing might have a small decimal part that does not show in output because of the setting of the DECIMALS option.
You are comparing two floating point numbers and at least one number is the result of an arithmetic operation.
You have mixed SHORTDECIMAL
and DECIMAL
data types in a comparison.
Oracle recommends that you use the ABS and ROUND functions to do approximate tests for equality and avoid all three causes of unexpected comparison failure. When using ABS or ROUND, you can adjust the absolute difference or the rounding factor to values you feel are appropriate for your application. When speed of calculation is important, then you probably want to use the ABS rather than the ROUND function.