CASE:
*CASE
The CASE expression is used to implement if-then logic.
WHEN compare1 THEN result1
[WHEN compare2 THEN result2]…
[ELSE resultX]
END
WHEN condition1 THEN result1
[WHEN condition2 THEN result2]…
[ELSE resultX]
END
The simple CASE expression returns the first result whose compareX value is equal to the input_expression.
The searched CASE expression returns the first result whose conditionX is true.