优艾设计网

mysql 创建存储过程中用到循环,怎么通过select返回结果集 财富值20?

优艾设计网 https://www.uibq.com 2023-04-23 19:01 出处:网络 作者:PS抠图
CREATE procedure ceshi(in Str varchar(2048),in SplitChar varchar(50))begindeclare ind int;declare unit优艾设计网_设计圈 varchar(128);declare inext int;declare len int;declare i int;set ind=1;set i=1;s

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;


狂人阿飙湛 2022-09-01 13:23

优艾设计网_设计圈值放入数组?


0

精彩评论

暂无评论...
验证码 换一张
取 消