标签:sed val bst insert substring 调用 ring img creat
mysql没有split函数,这里手动写一个:
CREATE PROCEDURE sp_split(in c1 varchar(2000),in split1 varchar(20)) BEGIN CREATE TEMPORARY TABLE IF NOT EXISTS temp_split ( col varchar(20) ); DELETE FROM temp_split; while(instr(c1,split1)<>0) DO insert temp_split(col) values (substring(c1,1,instr(c1,split1)-1)); set c1 = INSERT(c1,1,instr(c1,split1),‘‘); END WHILE; insert temp_split(col) values (c1); END;
调用时也很简单:
call sp_split(‘abcd,dddd,wsdf,sefedf,ojljl‘,‘,‘); select * from temp_split;
标签:sed val bst insert substring 调用 ring img creat
原文地址:http://www.cnblogs.com/sczmzx/p/7778072.html