Mybatis的update语句报ORA-00911的错误。。我在mapper.xml没加分号

hhxxmmzzss 2016-07-20 02:32:19
语句如下。。。

<update id="updateTradingUnit" parameterType="CtpTradingUnitDataBean">
<![CDATA[
Update CTPTRADINGUNITTABLE Set
STATE={#state}
where UNITID = {#unitId}
]]>
</update>

原来有很多set,以为是哪个set写的有问题,特意删得只剩一个set,居然还报一样的错误。
确定末尾没有加分号。。

有没有大神帮忙看看,问题到底出在哪里。

异常信息:

org.springframework.jdbc.BadSqlGrammarException:
### Error updating database. Cause: java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符

### The error may involve com.baoteng.qts.ctp.tradingunit.updateTradingUnit-Inline
### The error occurred while setting parameters
### SQL: Update CTPTRADINGUNITTABLE Set STATE={#state} where UNITID = {#unitId}
### Cause: java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符

; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符
...全文
391 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
柒拾~ 2016-07-21
  • 打赏
  • 举报
回复
无语了,你自己把格式写错了,UNITID = #{unitId}这样才对,把# 写在外面。
枫醉秋 2016-07-21
  • 打赏
  • 举报
回复
引用 1 楼 tf0003 的回复:
#号写在外边 <update id="updateTradingUnit" parameterType="CtpTradingUnitDataBean"> <![CDATA[ Update CTPTRADINGUNITTABLE Set STATE=#{state} where UNITID = #{unitId} ]]> </update>
这个才是正确的
tf0003 2016-07-20
  • 打赏
  • 举报
回复
#号写在外边 <update id="updateTradingUnit" parameterType="CtpTradingUnitDataBean"> <![CDATA[ Update CTPTRADINGUNITTABLE Set STATE=#{state} where UNITID = #{unitId} ]]> </update>

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧