php - mysql 创建存储过程中用到循环,怎么通过select返回结果集
ringa_lee
ringa_lee 2017-04-10 17:36:17
0
1
699

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;

ringa_lee
ringa_lee

ringa_lee

répondre à tous(1)
Ty80

把值放入数组?

Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal