美文网首页
mybatis+oracle批量新增

mybatis+oracle批量新增

作者: 没见过的颜色 | 来源:发表于2020-01-01 17:01 被阅读0次

sql语句
INSERT ALL
into test_2020(id,name) values('1','1')
into test_2020(id,name) values('2','2')
into test_2020(id,name) values('3','3')
SELECT 1 FROM dual

myBatis映射文件 xxxxxmapper.xml

<insert id="batchCreateUser" parameterType="com.test.bean.userBean">
INSERT ALL
<foreach collection="list" item="obj" index="index" separator=" ">
into test_2020(id,name) values(#{obj.id},#{obj.name})
</foreach>
SELECT 1 FROM dual
</insert>

相关文章

网友评论

      本文标题:mybatis+oracle批量新增

      本文链接:https://www.haomeiwen.com/subject/sshgoctx.html