sql存储过程insert 后的错误检查很重要。否则出错前台无法知道

来源:互联网 发布:市场营销数据分析 编辑:程序博客网 时间:2024/06/06 01:11

 insert CBC_PRecvGoodsOutDetail(Porder, InPorder, Code, InType, OutQty, 
            Price, PurPrice, OutTotal, salePrice,-- Unit, 
            PosNo, 
            LotNo,
            TgtSiteNo, SrcSiteNo, BusiDate, smemo, createdate, 
            creator, lastupdate, lastupdateuser, resultid, SID) values(
            @p_vcPorder, @vcInPorder, @p_vcProdCode, @p_vcOutType, @fOutQty,
            @fCostPrice, 0, cast(isnull(@fCostPrice, 0)* @fOutQty as numeric(18, 2)),  @p_fSalePrice, --@vcUnit, 
            @vcPosNo,
            @p_vcLotNo,
            @p_vcTgtSiteNo, @p_vcSiteNo, convert(varchar(10), @dtOutDate, 120), '出库', getdate(),
            @p_vcUserId, getdate(), @p_vcUserId, null, @iSID) 

    /*
            
        if @@ERROR <> 0 
        begin
          set @p_iRetCode = 10002
          set @p_vcRetMsg = '数据错误:Insert CBC_PRecvGoodsOutDetail......'
          return -1        
        end   

*/

        if @fRestQty <= 0
        begin
          break
        end

0 0