col3为零时如何处理?你得写明呀

解决方案 »

  1.   

    update tab1 set col1 = case col3 when 0 then col1 else col2/col3 end
      

  2.   

    我指的是业务逻辑,你看下面的得对吗?
    update tab1 set col1 = case col3 when 0 then col2 else col2/col3 end
      

  3.   

    set col1 =case col3 when 0 then null else col2/col3 end
      

  4.   

    update tab1 set col1 = col2/case when col3=0 then 1 else col3 end
      

  5.   

    update tab1 set col1 = case col3 when 0 then 1 else col2/col3 end