mysql-函数

BEGIN
DECLARE sTemp LONGTEXT;
DECLARE sTempChd VARCHAR(4000);


SET sTemp = NULL;
SET sTempChd =cast(rootId as CHAR);

SET sTemp = sTempChd;
WHILE sTempChd is not null DO


SELECT group_concat(group_id) INTO sTempChd FROM sys_group
where FIND_IN_SET(parent_id,sTempChd)>0 and (is_delete is null or is_delete = '0');
if sTempChd is not null and sTempChd<>'' then

SET sTemp = concat(sTemp,',',sTempChd);

end if;
END WHILE;
RETURN sTemp;
END

posted @   〆平平淡淡才是真  阅读(371)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示