CREATE FUNCTION `getChildLst`(`rootId` INT) RETURNS VARCHAR(1000)
BEGIN
DECLARE sTemp VARCHAR(1000);
DECLARE sTempChd VARCHAR(1000);
SET sTemp = null;
SET sTempChd =cast(rootId as CHAR);
WHILE sTempChd is not null DO
SET sTemp = concat_ws(',',sTemp,sTempChd,null);
SELECT group_concat(id) INTO sTempChd FROM test where FIND_IN_SET(pid,sTempChd)>0;
END WHILE;
RETURN sTemp;
END
层数返回受RETURNS VARCHAR(1000)大小影响