(1) 简单形式
语法:
CASE expr
WHEN search_val1 THEN result1
[WHEN search_val2 THEN result2 …]
[ELSE result_default]
END
CASE num
WHEN 1 THEN 'a'
WHEN 2 THEN 'b'
ELSE 'c'
END
(2) 搜索形式
语法:
CASE
WHEN condition1 THEN result1
[WHEN condition2 THEN result2 …]
[ELSE result_default]
END
CASE
WHEN DEVICE_NUMBER IS NULL THEN 1
ELSE 0
END