| 您的当前位置:首页 --> MYSQL教程 --> mysql存储过程实现split示例 |
| MYSQL教程 mysql存储过程实现split示例 |
| 浏览次数:1119 关键词 ( ) |
| 查看使用该CPU的产品 查看CPU天梯 |
| CPU型号:mysql存储过程实现split示例 |
| 主频:Ghz |
| 睿频:Ghz |
| 核心数:个 |
| 不支持超核心 |
| 制作工艺: |
| 插槽类型: |
| 功耗:0W |
| L3缓存:0MB |
| 支持最大内存: 0GB |
| CPU详细参数 |
|
复制代码 代码如下: call PROCEDURE_split('分享,代码,片段',','); select * from splittable; 复制代码 代码如下: drop PROCEDURE if exists procedure_split; CREATE PROCEDURE `procedure_split`( inputstring varchar(1000), delim char(1) ) begin declare strlen int DEFAULT length(inputstring); declare last_index int DEFAULT 0; declare cur_index int DEFAULT 1; declare cur_char VARCHAR(200); declare len int; drop temporary table if exists splittable; create TEMPORARY table splittable( value VARCHAR(20) ) ; WHILE(cur_index<=strlen) DO begin if substring(inputstring from cur_index for 1)=delim or cur_index=strlen then set len=cur_index-last_index-1; if cur_index=strlen then set len=len+1; end if; insert into splittable(`value`)values(substring(inputstring from (last_index+1) for len)); set last_index=cur_index; end if; set cur_index=cur_index+1; END; end while; end ; |
| 下一个产品 SQL计算timestamp的差值的方法 上一个产品 Mysql中Table ‘XXX’ is marked as crashed and last (automatic?)问题解决方法 |