NULLIF is a miscellaneous function that returns a NULL value if the arguments are equal.
CASE WHEN e1=e2 THEN NULL ELSE e1 END
When e1=e2 evaluates to unknown (because one or both of the arguments is NULL), NULLIF returns the value of the first argument.