--------------------------------------------------------------
您好,我们是“2006中国杰出数据库工程师评选”活动组委会。
您的帖子已经被我们转载到本次评选官方网站的“专家在线答疑”区。
http://www.bestdba.cn/match_discussion.aspx在那里,进入本次评选终选的30位数据库工程师将与您展开积极的互动。他们会为您的问题提供满意的答案,此外,您还可以在“专家在线答疑”区提出新的问题并参与讨论。您的帖子位于:
http://www.bestdba.cn/match_discussion3.aspx?pointid=544&pointid2=1&pointid3=5&pcount=stc
非常感谢您对本次活动的支持!
--------------------------------------------------------------

解决方案 »

  1.   

    可以用事物 transaction 来实现, mysql 自动封锁管理资源结构大体这样:start transaction;  if error ... then
        rollback 
        return.
       end ifcommit
      

  2.   

    start transaction;
       update ...
      
      if error ... then
        rollback 
        return.
       end if   update ...  if error ... then
        rollback 
        return.
       end if
    commit