DROP PROCEDURE IF EXISTS myconcat;
delimiter //
CREATE PROCEDURE myconcat(OUT str VARCHAR(255))
BEGIN
DECLARE MYSTR VARCHAR(255);
DECLARE FLAG VARCHAR(255);
DECLARE cur CURSOR FOR SELECT CONCAT(`value`,'.',name) FROM tb_sys_dict WHERE code = 'PAGE_ICON_TYPE';
DECLARE CONTINUE HANDLER FOR NOT FOUND SET MYSTR = NULL;
OPEN cur;
SET FLAG = '';
FETCH cur INTO MYSTR;
WHILE(MYSTR IS NOT NULL) DO
#SELECT MYSTR;
SET FLAG = CONCAT(FLAG,MYSTR);
#SELECT FLAG;
FETCH cur INTO MYSTR;
END WHILE;
CLOSE cur;
SELECT FLAG;
END //
delimiter;
SET @str = '';
CALL myconcat(@str);
SELECT @str AS aaa;