Is there a function which the opposite of NULLIF? I am aware of the NULLIF function which compares two values and returns NULL if they match.

Is there a function which will compare two values and return NULL if they don’t match? That is filter out the other values.

I know I can do something like that using CASE:

CASE column WHEN value THEN 1 END


I also know that I can write a function.

Perhaps there is a subtle trick to using NULLIF that I am unaware of.

I have listed a few versions of SQL in the tags, but I think NULLIF is generic. I am looking for a solution which is also generic, so that it can be applied to any standard database.
NULLIF(expr1, NULLIF(expr1, expr2)) does what you want.