Use the CASE and NULLIF expressions for conditional expressions
in
NULLIF expression syntax
CASE expression syntax
You can place a CASE expression anywhere an expression is allowed. It chooses an expression to evaluate based on a boolean test.
ThenExpression and ElseExpression are both expressions that must be type-compatible. For built-in types, this means that the types must be the same or a built-in broadening conversion must exist between the types.
You do not need to use the CASE expression for avoiding NullPointerExceptions when
a nullable column becomes a method receiver.