sql语句报错,解决不了,请大神看看啊 。。。急急急。。

非常着急 请大神速速看看,万分感谢。。

我的sql语句

 <update id="updateByPrimaryKeySelective" parameterType="java.util.List">
    <foreach collection="list" item="item" index="index" open="begin" close=";end;" separator=";">
    update TSM_CAS_R001
    <set >
      <if test="item.casNo != null">
        cas_no = #{item.casNo,jdbcType=VARCHAR},
      </if>
      <if test="item.chDic != null">
        ch_dic = #{item.chDic,jdbcType=VARCHAR},
      </if>
      <if test="item.cSeqid != null">
        c_seqid = #{item.cSeqid,jdbcType=VARCHAR},
      </if>
      <if test="item.srNo != null">
        sr_no = #{item.srNo,jdbcType=VARCHAR},
      </if>
      <if test="item.casArbegdtime != null">
        cas_arbegdtime = #{item.casArbegdtime,jdbcType=VARCHAR},
      </if>
      <if test="item.casArenddtime != null">
        cas_arenddtime = #{item.casArenddtime,jdbcType=VARCHAR},
      </if>
      <if test="item.casArintime != null">
        cas_arintime = #{item.casArintime,jdbcType=VARCHAR},
      </if>
      <if test="item.casArouttime != null">
        cas_arouttime = #{item.casArouttime,jdbcType=VARCHAR},
      </if> 
      <if test="item.casNcarouttime != null">
        cas_ncarouttime = #{item.casNcarouttime,jdbcType=DECIMAL},
      </if>
      <if test="item.casSmsartime != null">
        cas_smsartime = #{item.casSmsartime,jdbcType=VARCHAR},
      </if>
      <if test="item.casOnldartime != null">
        cas_onldartime = #{item.casOnldartime,jdbcType=VARCHAR},
      </if>
      <if test="item.casCastmp1 != null">
        cas_castmp1 = #{item.casCastmp1,jdbcType=DECIMAL},
      </if>
      <if test="item.casCastmp1time != null">
        cas_castmp1time = #{item.casCastmp1time,jdbcType=VARCHAR},
      </if>
      <if test="item.casCastmp2 != null">
        cas_castmp2 = #{item.casCastmp2,jdbcType=DECIMAL},
      </if>
      <if test="item.casCastmp2time != null">
        cas_castmp2time = #{item.casCastmp2time,jdbcType=VARCHAR},
      </if>
      <if test="item.casCastmp3 != null">
        cas_castmp3 = #{item.casCastmp3,jdbcType=DECIMAL},
      </if>
      <if test="item.casCastmp3time != null">
        cas_castmp3time = #{item.casCastmp3time,jdbcType=VARCHAR},
      </if>
      <if test="item.casArmaxwgt != null">
        cas_armaxwgt = #{item.casArmaxwgt,jdbcType=DECIMAL},
      </if>
      <if test="item.casArminwgt != null">
        cas_arminwgt = #{item.casArminwgt,jdbcType=DECIMAL},
      </if>
      <if test="item.casAravgwgt != null">
        cas_aravgwgt = #{item.casAravgwgt,jdbcType=DECIMAL},
      </if>
      <if test="item.casArmaxpres != null">
        cas_armaxpres = #{item.casArmaxpres,jdbcType=DECIMAL},
      </if>
      <if test="item.casArminpres != null">
        cas_arminpres = #{item.casArminpres,jdbcType=DECIMAL},
      </if>
      <if test="item.casAravgpres != null">
        cas_aravgpres = #{item.casAravgpres,jdbcType=DECIMAL},
      </if>
      <if test="item.casArvtmp != null">
        cas_arvtmp = #{item.casArvtmp,jdbcType=DECIMAL},
      </if>
      <if test="item.casDeptmp != null">
        cas_deptmp = #{item.casDeptmp,jdbcType=DECIMAL},
      </if>
      <if test="item.casQmessage != null">
        cas_qmessage = #{item.casQmessage,jdbcType=VARCHAR},
      </if>
      <if test="item.casQtime != null">
        cas_qtime = #{item.casQtime,jdbcType=VARCHAR},
      </if>
      <if test="item.casTimedf != null">
        cas_timedf = #{item.casTimedf,jdbcType=VARCHAR},
      </if>
      <if test="item.casAttdate != null">
        cas_attdate = #{item.casAttdate,jdbcType=VARCHAR},
      </if>
      <if test="item.casAccdate != null">
        cas_accdate = #{item.casAccdate,jdbcType=VARCHAR},
      </if>
      <if test="item.wkGroup != null">
        wk_group = #{item.wkGroup,jdbcType=VARCHAR},
      </if>
      <if test="item.wkShift != null">
        wk_shift = #{item.wkShift,jdbcType=VARCHAR},
      </if>
      <if test="item.cCreater != null">
        c_creater = #{item.cCreater,jdbcType=VARCHAR},
      </if>
      <if test="item.dCreatedate != null">
        d_createdate = #{item.dCreatedate,jdbcType=VARCHAR},
      </if>
      <if test="item.delFlag != null">
        del_flag = #{item.delFlag,jdbcType=VARCHAR},
      </if>
      <if test="item.cTimestamp != null">
        c_timestamp = #{item.cTimestamp,jdbcType=TIMESTAMP},
      </if>
      <if test="item.cSw01 != null">
        c_sw01 = #{item.cSw01,jdbcType=VARCHAR},
      </if>
      <if test="item.cSw02 != null">
        c_sw02 = #{item.cSw02,jdbcType=VARCHAR},
      </if>
      <if test="item.cSw03 != null">
        c_sw03 = #{item.cSw03,jdbcType=VARCHAR},
      </if>
      <if test="item.cSw04 != null">
        c_sw04 = #{item.cSw04,jdbcType=VARCHAR},
      </if>
      <if test="item.cSw05 != null">
        c_sw05 = #{item.cSw05,jdbcType=VARCHAR},
      </if>
      <if test="item.cSw06 != null">
        c_sw06 = #{item.cSw06,jdbcType=VARCHAR},
      </if>
      <if test="item.cSw07 != null">
        c_sw07 = #{item.cSw07,jdbcType=VARCHAR},
      </if>
      <if test="item.cSw08 != null">
        c_sw08 = #{item.cSw08,jdbcType=VARCHAR},
      </if>
      <if test="item.cSw09 != null">
        c_sw09 = #{item.cSw09,jdbcType=VARCHAR},
      </if>
      <if test="item.cSw10 != null">
        c_sw10 = #{item.cSw10,jdbcType=VARCHAR},
      </if>
      <if test="item.cSw11 != null">
        c_sw11 = #{item.cSw11,jdbcType=VARCHAR},
      </if>
      <if test="item.cSw12 != null">
        c_sw12 = #{item.cSw12,jdbcType=VARCHAR},
      </if>
      <if test="item.cSw13 != null">
        c_sw13 = #{item.cSw13,jdbcType=VARCHAR},
      </if>
      <if test="item.cSw14 != null">
        c_sw14 = #{item.cSw14,jdbcType=VARCHAR},
      </if>
      <if test="item.cSw15 != null">
        c_sw15 = #{item.cSw15,jdbcType=VARCHAR},
      </if>
      <if test="item.cStirstate != null">
        c_stirstate = #{item.cStirstate,jdbcType=VARCHAR},
      </if>
    </set>
          where sk_no = #{item.skNo,jdbcType=VARCHAR}
     </foreach>
  </update>

报的异常如下:

SEVERE: Servlet.service() for servlet [MES] in context with path [/MES] threw exception [Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException:

Error updating database. Cause: java.sql.SQLException: ORA-06550: 第 4 行, 第 7 列:

PL/SQL: ORA-00971: 缺失 SET 关键字
ORA-06550: 第 2 行, 第 5 列:
PL/SQL: SQL Statement ignored
ORA-06550: 第 8 行, 第 7 列:
PL/SQL: ORA-00971: 缺失 SET 关键字
ORA-06550: 第 6 行, 第 5 列:
PL/SQL: SQL Statement ignored

The error may involve td.young.smp.sm.bof.dao.TSM_CAS_R001Mapper.updateByPrimaryKeySelective-Inline

The error occurred while setting parameters

SQL: begin update TSM_CAS_R001 where sk_no = ? ; update TSM_CAS_R001 where sk_no = ? ;end;

Cause: java.sql.SQLException: ORA-06550: 第 4 行, 第 7 列:

PL/SQL: ORA-00971: 缺失 SET 关键字
ORA-06550: 第 2 行, 第 5 列:
PL/SQL: SQL Statement ignored
ORA-06550: 第 8 行, 第 7 列:
PL/SQL: ORA-00971: 缺失 SET 关键字
ORA-06550: 第 6 行, 第 5 列:
PL/SQL: SQL Statement ignored

; bad SQL grammar []; nested exception is java.sql.SQLException: ORA-06550: 第 4 行, 第 7 列:
PL/SQL: ORA-00971: 缺失 SET 关键字
ORA-06550: 第 2 行, 第 5 列:
PL/SQL: SQL Statement ignored
ORA-06550: 第 8 行, 第 7 列:
PL/SQL: ORA-00971: 缺失 SET 关键字
ORA-06550: 第 6 行, 第 5 列:
PL/SQL: SQL Statement ignored
] with root cause
java.sql.SQLException: ORA-06550: 第 4 行, 第 7 列:
PL/SQL: ORA-00971: 缺失 SET 关键字
ORA-06550: 第 2 行, 第 5 列:
PL/SQL: SQL Statement ignored
ORA-06550: 第 8 行, 第 7 列:
PL/SQL: ORA-00971: 缺失 SET 关键字
ORA-06550: 第 6 行, 第 5 列:
PL/SQL: SQL Statement ignored

这是怎么回事?请大神看看。。我解决了半天感觉是一点问题没有啊?问什么老是报
这个异常呢?实在是解决不了啊。。。

update语句至少有一个set吧

https://www.cnblogs.com/yangy608/p/3912580.html
实在不行可以只写单个插入语句,然后在后台循环进行插入

另外还有一种微小的可能是和你set后面的空格有关

当所有数据都为空 就没有set关键字了

begin update TSM_CAS_R001 where sk_no = ? ; update TSM_CAS_R001 where sk_no = ? ;end;

你的SQL打印出来问题很明显啊。两条数据的update,不知道update什么呢,没有set关键字。你这个SQL应该最起码加一个肯定不为空的字段,比如时间戳,来更新,保证不会出错。

是不是要用"trim" 标签

update 后面缺少set关键字, 正常修改方法是 update table1 set a='1' where b='1'

检查下你这个句

用这种方式试试

SQL: begin update TSM_CAS_R001 where sk_no = ? ; update TSM_CAS_R001 where sk_no = ? ;end;
那看上去就是数据没有传过来了,除了sk_no

这里需要分情况写吧, 数据为空,不做操作,否则如上

update 后面缺少set关键字, 正常修改方法是 update table1 set a='1' where b='1'

老铁,把if判断里面的item去掉,item是你foreach循环体,不是你的参数名

这个如果是缺少关键set的话你需要在代码里面看下你的集合里面的实体类里面的属性,如果缺失,难道实体类里面都是null?

为了防止你set中的所有字段都为空,导致update缺少set,可在其中加一个保底字段,既不影响原来数据,又能防止全部为空时set缺失情况,可以将字段本身的值付给他自己,如:在<set></set>开头处加一个:cas_no = cas_no,

楼主是不是用的mybatis 已经支持 update。。。。;update......;。。。。。。形式的语句了 ? 如果还是不支持,楼主就要改sql 不能 写成 语句1;语句2;。。。。这样凑起来的形式!

你这个是全部为空了,没有任何set有值。常见的情况下很少出现这样的情况。我不建议你对xml的配置文件做修改,
应该对提交的对象赋值做的科学一些,因为就算是全表单全部置空(再无任何验证非空的情况下),也应该是把对应属性全部设为“”这样的值才对,
而有值的情况下,更应该是符合实际情况的数据更新了。
而这里竟然传入了一个完全为空的对象,需求本身应该不会是这样吧,所以应该是整个对象在进入Service之前肯定不能让它全为空的,
如果真的全为空,最起码应该验一下空,把空值对象隔绝在服务层之前的。

你这句是错误的,应该是: