The keyword NULL can only be used in a context where its data type is known.
So, it's e.g. valid to use it with INSERT, as in
Code:
INSERT INTO mytable (col1, col2) VALUES ('value1', NULL)
You may use it in any other context where a constant value is valid, but in that case only after an explicit type cast, e.g.
or
Code:
CAST(NULL as CHAR(20))
(or of course alternatively with the "old" casting methods INT(NULL) or CHAR(NULL,20)).
Your condition
Code:
WHERE eh.toblm = coalesce(expr, eh.toblm)
makes sense, and will indeed be a "no-op", i.e., match everything, when expr has the NULL value. But it should be of a datatype which is compatible with eh.toblm for that expression to be accepted by DB2, so plugging in NULL for expr won't work while e.g. CAST(NULL as INT) will work (provided eh.toblm is of a numeric type).