IN&存储过程OUT参数

时间:2018-01-03 04:57:59

标签: mysql stored-procedures

希望每个人都做得好!

需要有关存储过程的帮助。创建过程时出现以下错误。任何帮助都很受欢迎。

  

错误:#1064 - 您的SQL语法出错;检查手册   对应于您的MySQL服务器版本,以获得正确的语法   在'CREATE PROCEDURE regi_email附近使用(IN电子邮件VARCHAR(255),counti   OUT INT)

     

BEGIN

     

'第3行

我的程序如下:

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;

1 个答案:

答案 0 :(得分:1)

此行中的错误需要更改为:

CREATE PROCEDURE regi_email (IN email VARCHAR(255),OUT counti  INT)

修改

#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 ;