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;

浙公网安备 33010602011771号