Create Stored Procedure with Parameters in MySQL

Last Reply 22 days ago By dharmendr

Posted 22 days ago

Please I need help running this  MYSQL STORED PROCEDURE query in phpmyadmin - I get error 1064 -NOT DETERMINISTIC NO SQL SECURITY DEFINER

CREATE PROCEDURE GetCorrectAnswer
@getid VARCHAR(MAX)
AS
BEGIN
DECLARE @Correct VARCHAR(50)
SELECT @Correct = answer FROM tbl_questions WHERE question = @getid
SELECT CASE @Correct
WHEN 'OptionOne' THEN (SELECT OptionOne FROM tbl_questions WHERE question = @getid)
WHEN 'OptionTwo' THEN (SELECT OptionTwo FROM tbl_questions WHERE question = @getid)
WHEN 'OptionThree' THEN (SELECT OptionThree FROM tbl_questions WHERE question = @getid)
WHEN 'OptionFour' THEN (SELECT OptionFour FROM tbl_questions WHERE question = @getid)
END Answer
FROM tbl_questions
WHERE question = @getid
END

 

You are viewing reply posted by: dharmendr 22 days ago.
Posted 22 days ago

Refer below article for writing stored procedure in MySql.

Call MySql Stored Procedure with Parameters in ASP.Net, C# and VB.Net