Is Null Greater Than Any Date Data Type?

后端 未结 3 1060
傲寒
傲寒 2021-02-12 12:49

I have this query in DB2

SELECT * FROM SOMESCHEMA.SOMETABLE WHERE SYSDATE > @A

If the SYSDATE is NULL, would it be

3条回答
  •  一整个雨季
    2021-02-12 13:27

    Another possibility is to use IS NULL to test if a value is null:

      SELECT * FROM SOMESCHEMA.SOMETABLE WHERE SYSDATE > @A OR SYSDATE IS NULL
    

    will include the value in your set of returned values, instead of COALESCE function. It works only with simple cases though.

提交回复
热议问题