drop procedure if exists dblongba;
create procedure dblongba()
begin
declare Itemid int;
declare char_id int;
declare item_name varchar(30);
declare char_name varchar(30); declare stop int default 0; declare rs_cursor cursor for select itemid from william_item_update; declare CONTINUE HANDLER FOR SQLSTATE '02000' SET stop=1; open rs_cursor;
fetch rs_cursor into Itemid;
while stop<> 1 do
select char_id into char_id from character_items where id=Itemid;
select item_name into item_name from character_items where id=Itemid;
update william_item_update set Equipmentname=item_name where itemid=Itemid;
if char_id>0 then
select char_name into char_name from characters where objid=char_id;
update william_item_update set Rolename=char_name where itemid=Itemid;
end if;
fetch rs_cursor into Itemid;
end while;
close rs_cursor;
end;
执行完这个存储过程取不出值是什么原因?在fetch rs_cursor into Itemid;测试取出来的Itemid是空的...
create procedure dblongba()
begin
declare Itemid int;
declare char_id int;
declare item_name varchar(30);
declare char_name varchar(30); declare stop int default 0; declare rs_cursor cursor for select itemid from william_item_update; declare CONTINUE HANDLER FOR SQLSTATE '02000' SET stop=1; open rs_cursor;
fetch rs_cursor into Itemid;
while stop<> 1 do
select char_id into char_id from character_items where id=Itemid;
select item_name into item_name from character_items where id=Itemid;
update william_item_update set Equipmentname=item_name where itemid=Itemid;
if char_id>0 then
select char_name into char_name from characters where objid=char_id;
update william_item_update set Rolename=char_name where itemid=Itemid;
end if;
fetch rs_cursor into Itemid;
end while;
close rs_cursor;
end;
执行完这个存储过程取不出值是什么原因?在fetch rs_cursor into Itemid;测试取出来的Itemid是空的...
SET stop=0