Int -> varcher
将Int 转为varchar可以用 concat()
函数,比如 concat(8,’0′)
得到字符串 ’80′。
delete from core_channel;
drop procedure if exists insert_channel;
delimiter //
CREATE procedure insert_channel()
wholeblock:BEGIN
declare str VARCHAR(255) default '';
declare x INT default 0;
SET x = 1;
WHILE x <= 10 DO
insert into core_channel (name) values (CONCAT("name",x));
SET x = x + 1;
END WHILE;
select str;
END//
call insert_channel ();