[英]stored procedure with IN & OUT parameter
Hope everyone is doing well ! 希望大家一切都好!
Need help on stored procedure. 在存储过程上需要帮助。 Getting following error while creating the procedure.
创建过程时出现以下错误。 Any help is well appreciated.
任何帮助都将不胜感激。
error: #1064 - You have an error in your SQL syntax;
错误:#1064-您的SQL语法有错误; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE PROCEDURE regi_email (IN email VARCHAR(255), counti OUT INT)
检查与您的MySQL服务器版本相对应的手册以获取正确的语法,以在'CREATE PROCEDURE regi_email(IN email VARCHAR(255),counti OUT INT)附近使用
BEGIN
开始
' at line 3
'在第3行
MY Procedure is as below: 我的程序如下:
DELIMITER $$
USE hsiedwzw_booking
CREATE PROCEDURE regi_email (IN email VARCHAR(255), counti OUT INT)
BEGIN
DECLARE bContinue INTEGER;
SELECT COUNT(*) INTO bContinue FROM parent_reg_email WHERE reg_email =email;
IF bContinue=0;
THEN SET @counti=1;
ELSE SELECT COUNT(*) INTO bContinue FROM ets_bookings WHERE c_email =email;
IF bContinue=0;
SET @counti=2;
ELSE SET @counti=3;
END IF;
END
$$
DELIMITER;
You have an error in this line need to change like: 您在此行中有一个错误需要更改,例如:
CREATE PROCEDURE regi_email (IN email VARCHAR(255),OUT counti INT)
Edit: 编辑:
#DEFINER=`root`@`localhost` is for your server ;;
USE hsiedwzw_booking;
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `activeFor_accounthead`(IN email VARCHAR(255),OUT counti INT)
BEGIN
DECLARE bContinue INTEGER;
SELECT COUNT(*) INTO bContinue FROM parent_reg_email WHERE reg_email =email;
IF bContinue=0;
THEN SET @counti=1;
ELSE SELECT COUNT(*) INTO bContinue FROM ets_bookings WHERE c_email =email;
IF bContinue=0;
SET @counti=2;
ELSE SET @counti=3;
END IF;
END$$
DELIMITER ;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.