當前位置:成語大全網 - 書法字典 - Mysql字典光標提取數

Mysql字典光標提取數

根據妳的信息,正確答案應該如下:望采納。

CREATE DEFINER = ` root `@ ` localhost `過程` p _ updateud 18 `(` param ` int(11))

開始

聲明Rcount,I,j,k,Rparentid,myId int(11)默認為0;

聲明Robjname,Robjname23,Robjname45,Robjname67,Robjname 89 varchar(9)default“”;

從ud18中選擇計數(id)到Rcount

重復

select id,objname into myId,Robjname from ud 18 order by id limit I,1;

set robj name 23 = SUBSTRING(robj name,2,2);

set robj name 45 = SUBSTRING(robj name,4,2);

set robj name 67 = SUBSTRING(robj name,6,2);

set robj name 89 = SUBSTRING(robj name,8,2);

如果Robjname89 & gt那就0

set @ SQL = concat(“select id into @ ABC from ud 18 where objname like‘“,left(Robjname,7),“00“,“‘‘“;

從@sql準備stmt

執行stmt

set Rparentid = @ abc

update ud 18 set parentid = Rparentid其中id = myId

elseif Robjname67 & gt那就0

set @ SQL = concat(“select id into @ ABC from ud 18 where objname like““,left(Robjname,5),“0000“,“‘“;

從@sql準備stmt

執行stmt

set Rparentid = @ abc

update ud 18 set parentid = Rparentid其中id = myId

elseif Robjname45 & gt那就0

set @ SQL = concat(“select id into @ ABC from ud 18 where objname like““,left(Robjname,3),“000000“,““‘“;

從@sql準備stmt

執行stmt

set Rparentid = @ abc

update ud 18 set parentid = Rparentid其中id = myId

elseif Robjname23 & gt那就0

-set @ SQL = concat(“select id into @ ABC from ud 18 where objname like““,left(Robjname,1),“0000000“,“‘“;

-從@sql準備stmt

-執行stmt

-set Rparentid = @ ABC;

update ud18 set parentid=0其中id = myId

其他

設置j = 0;

end if

set I = I+1;

直到我& gtRcount結束重復;

結束;