informix 的存储过程中 case 怎么写?
CREATE PROCEDURE get_name
(
type int
)
RETURNING varchar(64);
DEFINE neName varchar(64);
CASE type
WHEN 1 THEN
LET neName = '1';
WHEN 2 THEN
LET neName = '2';
WHEN 3 THEN
LET neName = '3';
WHEN 4 THEN
LET neName = '4';
END CASE;
return neName;
END PROCEDURE;
哪儿错了?
[解决办法]
CASE在sql里使用,如:
CASE
WHEN fs_Deta is NULL THEN '0'
WHEN fs_Deta = '02' THEN '2'
ELSE '1'
END
在SPL里分支一般用IF