MYSQL 创建函数失败 半天没明白错再哪,求大神

[SQL]
delimiter $$
CREATE FUNCTION queryChildrenAreaInfo(areaId INT)
RETURNS VARCHAR(4000)
BEGIN
DECLARE sTemp VARCHAR(4000);
DECLARE sTempChd VARCHAR(4000);

SET sTemp='$';
SET sTempChd = CAST(areaId AS CHAR);

WHILE sTempChd IS NOT NULL DO
SET sTemp= CONCAT(sTemp,',',sTempChd);
SELECT GROUP_CONCAT(BRANCH) INTO sTempChd FROM t_areainfo WHERE FIND_IN_SET(ATTACHED_TO,sTempChd)>0;
END WHILE;
RETURN sTemp;
END $$

[Err] 1105 - line 1 column 15 near " queryChildrenAreaInfo(areaId INT)
RETURNS VARCHAR(4000)
BEGIN
DECLARE sTemp VARCHAR(4000);
DECLARE sTempChd VARCHAR(4000);

SET sTemp='$';
SET sTempChd = CAST(areaId AS CHAR);

WHILE sTempChd IS NOT NULL DO
SET sTemp= CONCAT(sTemp,',',sTempChd);
SELECT GROUP_CONCAT(BRANCH) INTO sTempChd FROM t_areainfo WHERE FIND_IN_SET(ATTACHED_TO,sTempChd)>0;
END WHILE;
RETURN sTemp;
END ;" (total length 407)

查看全部
u011906423
破妄的真实
2019/03/15 15:21
  • java
  • 点赞
  • 收藏
  • 回答
    私信

2个回复