指点成金-最美分享吧

登录

oracle mybatis 批量更新 怎么获取影响行数

佚名 举报

篇首语:本文由小编为大家整理,主要介绍了oracle mybatis 批量更新 怎么获取影响行数相关的知识,希望对你有一定的参考价值。

参考技术A 我也是新手,可以给你个思路。 select count(1) from table where ---- ,把你要更新或者删除的条件传入,查一下,那个就是 影响的条数。 高手勿喷!!本回答被提问者采纳

mybatis执行批量更新batch update 的方法(oracle,mysql)

有时候oracle的最后一个sql少个分号,要在end前面加上分号

 

oracle和mysql数据库的批量update在mybatis中配置不太一样:

oracle数据库:

"batchUpdate" parameterType="java.util.List"> "list" item="item" index="index" open="begin" close="end;" separator=";"> update test test=${item.test}+1 where id = ${item.id}

mysql数据库:

mysql数据库采用一下写法即可执行,但是数据库连接必须配置:&allowMultiQueries=true

例如:jdbc:mysql://192.168.1.236:3306/test?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true

"batchUpdate" parameterType="java.util.List"> "list" item="item" index="index" open="" close="" separator=";"> update test test=${item.test}+1 where id = ${item.id}

以上是关于oracle mybatis 批量更新 怎么获取影响行数的主要内容,如果未能解决你的问题,请参考以下文章