MYSQL存储过程-在MYSQL中编写此存储过程的正确方法是什么-我收到1064错误

时间:2018-10-29 20:03:41

标签: mysql stored-procedures

请问什么是在MYSQL中编写此存储过程的正确方法-我从phpmyadmin中收到1064错误

BEGIN
    DECLARE @Correct VARCHAR(50)
    SELECT @Correct = answer FROM tbl_questions WHERE id = @getid
    SELECT  CASE @Correct
            WHEN 'OptionOne' THEN (SELECT OptionOne FROM tbl_questions WHERE id = @getid)
            WHEN 'OptionTwo' THEN (SELECT OptionTwo FROM tbl_questions WHERE id = @getid)
            WHEN 'OptionThree' THEN (SELECT OptionThree FROM tbl_questions WHERE id = @getid)
            WHEN 'OptionFour' THEN (SELECT OptionFour FROM tbl_questions WHERE id = @getid)
    END Answer
    FROM tbl_questions
    WHERE id = @getid;
END;

0 个答案:

没有答案