Oracle通过myebatis批量添加数据

来源:互联网 发布:电脑加密软件下载 编辑:程序博客网 时间:2024/05/21 01:47
<!-- 批量插入 -->
    <insert id="inserts" parameterType="java.util.List">
     
            <!-- 在此处做了修改 -->
        insert into PRESON
        select SEQ_PRESON_ID.NEXTVAL,A.* from(
        <foreach collection="list" item="item" index="index"
            separator="UNION">
            SELECT
            #{item.presonName},
            #{item.presonTel},
            #{item.presonEmail},
            #{item.presonAge}
            from dual 
             </foreach>
        ) A
 
    </insert>

大家看一下就明白了!!

通过其他的方式 不适合oracle 只能通过这种方式来添加!!
原创粉丝点击