mybatis 对oracle 数据库用foreach实现 批量插入

<insert id="insertList">

  insert into tableName(column1 , column2 , column3)

  select t.* from(

    <foreach collection="list" item="obj" index="index" sperator="union all">

    (

      select 

        #{obj.field} column1 ,

        #{obj.field} column2,

        #{obj.field} column3

      from dual

    )

    </foreach>

  )t 

</insert>

 

posted @ 2018-05-30 14:46  new_boys  阅读(2598)  评论(0编辑  收藏  举报