**当我执行这个过程时,得到错误1064**

ffscu2ro  于 2021-06-18  发布在  Mysql
关注(0)|答案(1)|浏览(347)
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetStateList`(IN _CountryName VARCHAR(255))
BEGIN
    DECLARE @CCode VARCHAR(50)
SET @CCode = (SELECT CountryID  from countrylist where CountryName = _CountryName);
  SELECT @CCode;

END
txu3uszq

txu3uszq1#

您需要将分隔符重新定义为其他内容(例如: $$ )除 ; . 最后,将限制器复位至 ; . 此外,declare语句中缺少分号:

DELIMITER $$

CREATE DEFINER=`root`@`localhost` PROCEDURE `GetStateList`(IN _CountryName VARCHAR(255))

BEGIN
    DECLARE @CCode VARCHAR(50); -- semicolon was missing here
    SET @CCode = (SELECT CountryID  
                  from countrylist 
                  where CountryName = _CountryName);

    SELECT @CCode;

END$$

DELIMITER ;

相关问题