在mysql中编写这个存储过程的正确方法是什么-我得到了1064错误

zzzyeukh  于 2021-06-18  发布在  Mysql
关注(0)|答案(0)|浏览(196)

请问在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;

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题