and d.batch = #{batch} and (d.batch IS NULL OR d.batch = '') and d.brand = #{brand} and (d.brand IS NULL OR d.brand = '') and d.standby1 = #{standby1} and (d.standby1 IS NULL OR d.standby1 = '') and d.standby2 = #{standby2} and (d.standby2 IS NULL OR d.standby2 = '') and d.standby3 = #{standby3} and (d.standby3 IS NULL OR d.standby3 = '') and d.box_type1 = #{boxType1} and (d.box_type1 IS NULL OR d.box_type1 = '') and d.box_type2 = #{boxType2} and (d.box_type2 IS NULL OR d.box_type2 = '') and d.box_type3 = #{boxType3} and (d.box_type3 IS NULL OR d.box_type3 = '') and t.loc_no like '%' + #{locNo} + '%' and t.matnr like '%' + #{matnr} + '%' and t.owner = #{owner} and t.payment = #{payment} delete from asr_loc_detl where 1=1 and loc_no = #{locNo} and matnr = #{matnr} update asr_loc_detl set anfme = #{anfme} , modi_time = getdate() where 1=1 and loc_no = #{locNo} and matnr = #{matnr} and a.loc_no like '%' + #{loc_no} + '%' and a.matnr like '%' + #{matnr} + '%' and a.maktx like '%' + #{maktx} + '%' and a.anfme like '%' + #{anfme} + '%' and a.modi_time between #{startTime} and #{endTime} and b.crn_no=#{crnNo} and a.batch like '%' + #{batch} + '%' and a.specs like '%' + #{specs} + '%' UPDATE a SET a.matnr=b.matnr, a.specs=b.specs, a.maktx=b.maktx, a.unit=b.unit FROM asr_loc_detl a INNER JOIN man_mat b ON a.matnr=#{matnrOld} AND b.matnr=#{matnr}; update asr_loc_detl set frozen = 1 where loc_no = #{locNo} and frozen = 0 update asr_loc_detl set frozen = #{frozen} where loc_no = #{locNo} and matnr = #{matnr} and batch = #{batch}