我有这个存储过程,它的工作
CREATE PROCEDURE myrange()
BEGIN
SET @start = 0;
PREPARE stmt FROM ' SELECT firstname FROM peoples ORDER BY id LIMIT ?,1 INTO @name';
WHILE @start < 5 DO
EXECUTE stmt USING @start;
CASE
WHEN @name = 'Ana'
THEN INSERT INTO mytable (log) VALUES('yes');
ELSE
INSERT INTO mytable (log) VALUES('no');
END CASE;
SET @start = @start + 1;
END WHILE;
END;
但是,如果我从这个过程中删除,这段代码:
ELSE
INSERT INTO mytable (log) VALUES('no');
mysqli_error() 返回此错误:“CASE 语句未找到案例”。
有人知道,为什么?