oracle中的批量插入和更新,.xml中的代码,mybatis

新增

insert into xx_table (ID,X,X,X,X)
(
<foreach collection="xxList" item="item" index="index" separator="UNION ALL">
select
#{item.id}, #{item.X}
from dual
</foreach>
)

更新
BEGIN
<foreach collection="xxList" open="" close="" item="item" separator=";">
update xx_table
<set>
xx=#{item.xx},
xx=#{item.xx}
</set>
where
xx= #{item.xx}
and xx = #{item.xx}
</foreach>
;END;
posted @ 2024-07-30 18:08  tianjifei123  阅读(141)  评论(0)    收藏  举报