CREATE procedure ceshi(in Str varchar(2048),in SplitChar varchar(50))
begin
declare ind int;
declare unit varchar(128);
declare inext int;
declare len int;
declare i int;
set ind=1;
set i=1;
set len=length(Str);
while ind<=len do
begin
set inext=instr(Str,SplitChar);
if inext=0 then set inext=len+1; end if;
if inext>ind then
begin
set unit=ltrim(rtrim(substring(Str,1,inext-1)));
if unit<>' then
begin
select unit as Value,i as vindex; //这里的select每循环一次,值就不一样,我想让他作为结果集返 //回应该怎么做
set Str=substring(Str,inext+1);
set i=i+1;
select Str,ind,inext,len,unit;
end;
end if;
end;
end if;
end;
set ind=inext+1;
end while;
end;
付费偷看金额在0.1-10元之间
把值放入数组?
一周热门 更多>