Author: useit
Subject: VALIDATE NULL VALUE IN DB2 CASE STATEMENT
Posted: Thu Feb 09, 2017 4:34 pm (GMT 5.5)
Hi,
can we do some kind of case statement within the where clause to validate the null value of the column.
please find the example below.
I have a indicator "y" or "n". based on this indicator I need to select the value (where clause using db2 case).
in the below example if the IND = 'Y' i should select only the columns with TERM_DATE IS NULL. else select all the value.
A.TERM_DATE =
CASE WHEN IND = 'Y'
THEN NULL
ELSE A.TERM_DATE
END
i know we cannot check for = NULL and it has to be IS NULL. but IS NUL inside the case statement doesn't work. is there any other way of handling this scenario?
Regards,
useit
Subject: VALIDATE NULL VALUE IN DB2 CASE STATEMENT
Posted: Thu Feb 09, 2017 4:34 pm (GMT 5.5)
Hi,
can we do some kind of case statement within the where clause to validate the null value of the column.
please find the example below.
I have a indicator "y" or "n". based on this indicator I need to select the value (where clause using db2 case).
in the below example if the IND = 'Y' i should select only the columns with TERM_DATE IS NULL. else select all the value.
A.TERM_DATE =
CASE WHEN IND = 'Y'
THEN NULL
ELSE A.TERM_DATE
END
i know we cannot check for = NULL and it has to be IS NULL. but IS NUL inside the case statement doesn't work. is there any other way of handling this scenario?
Regards,
useit