CREATE DEFINER=`root`@`localhost` PROCEDURE `Mobile_ForgotPassword`(IN`v_email` VARCHAR(30), IN `v_valid` INT)
NO SQL
IF (v_valid = 0) THEN
SELECT email FROM user_registration WHERE email = v_email;
ELSE
SELECT password FROM user_registration WHERE email = v_email;
END IF;
我有这个MySQL存储过程而且它不起作用。每当我尝试在phpmyadmin上执行此脚本时,在第4行得到错误,我有语法错误。因为我正在使用phpmyadmin,分隔符已经动态添加,我有root帐户的权限。我试过去除DEFINER,但它仍然无法正常工作。据我所知,我没有在脚本中看到任何语法错误,或者我没有得到它。任何人?
答案 0 :(得分:1)
CREATE DEFINER=`root`@`localhost` PROCEDURE `Mobile_ForgotPassword`(IN `v_email` VARCHAR(30), IN `v_valid` INT)
NO SQL
IF (v_valid = 0) THEN
SELECT email FROM user_registration WHERE email = v_email LIMIT 1;
ELSE
SELECT password FROM user_registration WHERE email = v_email LIMIT 1;
END IF;
答案 1 :(得分:0)
您需要添加DELIMITER
DELIMITER |
CREATE PROCEDURE `Mobile_ForgotPassword`(IN`v_email` VARCHAR(30), IN `v_valid` INT)
NO SQL
IF (v_valid = 0) THEN
SELECT email FROM user_registration WHERE email = v_email;
ELSE
SELECT PASSWORD FROM user_registration WHERE email = v_email;
END IF;
|
DELIMITER ;