oracle mybatis 批量插入

六月ゝ 毕业季﹏ 提交于 2020-12-12 19:11:25

插入的值最好声明类型,否则可能出现些奇怪的错误。

<if test="list !=null and list.size()>0">
            INSERT INTO b_prehour_event_count (
                    id,
                    team_id,
                    period,
                    short_period,
                    amount,
                    create_time,
                    del_flag
                    )
            <foreach collection="list" index="index" item="item" separator="union all">
               SELECT
                    #{item.id,jdbcType=VARCHAR},
                    #{item.teamId,jdbcType=VARCHAR},
                    #{item.period,jdbcType=VARCHAR},
                    #{item.shortPeriod,jdbcType=VARCHAR},
                    #{item.total,jdbcType=VARCHAR},
                    sysdate,
                    0
                FROM dual
            </foreach>
        </if>

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!