testing inequality with columns that can be null

后端 未结 8 1145
不思量自难忘°
不思量自难忘° 2021-02-05 14:48

So, I asked a question this morning, which I did not phrase correctly, so I got a lot of responses as to why NULL compared to anything will give NULL/FALSE.

My actual q

8条回答
  •  逝去的感伤
    2021-02-05 15:47

    If you want to be sure about how NULLs are handled, you'll have to use whatever Informix supports for null checking. I haven't turned up much, other than the SE version doesn't support COALESCE, but it does support DECODE and possibly CASE.

    WHERE COALESCE(t.a, 0) != COALESCE(t.b, 0)
    WHERE DECODE(NULL, 0, t.a) != DECODE(NULL, 0, t.b)
    

提交回复
热议问题