Mybatis批量将list数据插入到Oracle数据库

foreach属性

 xml

insert into u_test ( id,lcid)
        <foreach collection="list" item="item" index="index" separator=" union all" open="(" close=")">
        select
            #{item.id},
            #{item.lcid} from dual
         </foreach>        

正常批量执行SQL

INSERT INTO u_test(id, lcid) (select '1','123' from dual union all select '2','345' from dual)

 

posted @ 2022-02-24 11:02  南北12345678  阅读(120)  评论(0编辑  收藏  举报