**当我执行此过程时,提示错误1064 **

时间:2018-10-24 06:42:47

标签: mysql

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

1 个答案:

答案 0 :(得分:0)

您需要将定界符重新定义为$$以外的其他名称(例如:;)。最后,将限制器重置回;。另外,在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 ;