first accept, kludge decision, sentinel approach (it is necessary that your program does not allow you to enter a sentinel value):
select coalesce(a, -2147483648) = coalesce(b, -2147483648) as is_equal
let's say you forgot to block the sentinel value in your program, the user entered -2147483648 in field B, and A - null. the code above reports true, should report false, should not report true and null.
What is the most concise way to compare field equality with a zero value? A == B should just report only true or false, whether the fields are null or not.
source
share