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
答案 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 ;