mysql存储过程,这个错在哪里?
begindeclarecc,aa,bbintdefault0;declaret_errorintdefault0;declareCONTINUEHANDLERFORSQ...
begin
declare cc,aa,bb int default 0;
declare t_error int default 0;
declare CONTINUE HANDLER FOR SQLEXCEPTION SET t_error=1;
START TRANSACTION;
select guid into aa from mop510_characters.character where name=uname;
if aa=0 then
select @bb:=max(guid) from mop510_characters.item_instance;
set bb=@bb+1;
insert into mop510_characters.item_instance(guid,itemEntry,count) values (bb,"1400001",ucount);
select @cc:=max(id) from mop510_characters.mail;
set cc=@cc+1;
insert into mop510_characters.mail(id,subject,body,hasitems,receiver) values (cc,"标题","内容",1,aa);
insert into mop510_characters.mail_items(mail_id,item_guid,receiver) values (cc,bb,aa);
end if;
if t_error = 1 then
rollback;
else
commit;
end if;
end 展开
declare cc,aa,bb int default 0;
declare t_error int default 0;
declare CONTINUE HANDLER FOR SQLEXCEPTION SET t_error=1;
START TRANSACTION;
select guid into aa from mop510_characters.character where name=uname;
if aa=0 then
select @bb:=max(guid) from mop510_characters.item_instance;
set bb=@bb+1;
insert into mop510_characters.item_instance(guid,itemEntry,count) values (bb,"1400001",ucount);
select @cc:=max(id) from mop510_characters.mail;
set cc=@cc+1;
insert into mop510_characters.mail(id,subject,body,hasitems,receiver) values (cc,"标题","内容",1,aa);
insert into mop510_characters.mail_items(mail_id,item_guid,receiver) values (cc,bb,aa);
end if;
if t_error = 1 then
rollback;
else
commit;
end if;
end 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询