begin
declare t_error integer default 0;
declare continue handler for sqlexception set t_error=1;
#set autocommit =0;
start transaction;
update mol_userlevelright set UserSetValue=20 where id=9;
if t_error = 1 then
rollback;
else
commit;
select 1;
end if;
end
原文:http://www.cnblogs.com/makqiq/p/6484567.html