MySQL字符分割并存储到临时表中
2016-12-01 22:43
323 查看
创建存储过程
在workbench测试查询结果
CREATE DEFINER=`root`@`localhost` PROCEDURE `split`(in _string varchar(300)) BEGIN # 求分割符号','的位置 declare _index int; #使用临时表存储分割后的结果 drop temporary table if exists tmp_strs; create temporary table tmp_strs( str int(10) unsigned ); set _index = locate(',',_string); while _index > 0 do insert into tmp_strs values(left(_string,_index-1));#将子字符串存入临时表 set _string =substr(_string from _index+1); set _index = locate(',',_string); end while; if length(_string) >= 0 then insert into tmp_strs values(_string); end if; END
在workbench测试查询结果
相关文章推荐
- mysql时间字段的格式与编码转换, C#下 xml 存储时间数据的临时解决方案
- Mysql存储过程中临时表的建立及游标遍历
- 利用MySQL存储过程分割字符串
- mysql 分割字符添加入多个字段
- mysql 存储字符表情
- 在SqlServer中把字符串以某个字符分隔,相当于其他编程语言中的split函数,把结果存储到临时表中,用游标逐行读取
- mysql 存储过程示例,有参有返回值,使用到了判断,循环,游标,临时表,事务
- Mysql的varchar(20)到底可以存储多少个中文字符
- Mysql存储过程(六)——存储过程中使用临时表
- 使MySQL能够存储emoji表情字符的设置教程
- mysql修改默认字符和默认存储引擎
- 实现4K大小的临时存储空间的字符设备驱动
- 利用MySQL存储过程分割字符串
- mysql存储过程中使用临时表
- 利用MySQL存储过程分割字符串
- Mysql存储过程(六)——存储过程中使用临时表
- 逗号分割的字符串存储到临时表中
- mysql存储过程用游标解决返回的结果级并拼装字符
- 利用MySQL存储过程分割字符串
- 使MySQL能够存储emoji表情字符的设置教程