我正在尝试IF
与内部的其他代码一起使用MySql
stored procedure
,但事情似乎并不顺利,我无法保存存储过程。如果我删除IF
一切正常,我就可以保存存储过程。
问题出IF
在里面。你能帮我吗?
错误
/* SQL Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF FIND_IN_SET (10,vals) THEN
'Grey Link'
ELSE
SET ret_val = 'Blue' at line 20 */
存储过程
BEGIN
DECLARE vals VARCHAR(2400);
DECLARE ret_val VARCHAR(2400);
select group_concat(elmAction) into vals from reports where id = this_id and userId = this_user;
SET ret_val = CASE this_id
WHEN 1 THEN CONCAT (
'Blue Type 1'
'Blue Type 2'
'Blue Type 3' #Here is where the problem is...
IF FIND_IN_SET (10,vals) THEN
'Grey Link'
ELSE
'Blue link'
END IF;
)
ELSE 'Error'
END;
RETURN (ret_val);
END