mybatis加oracle批量insert中的序列问题,可不可以用union做批量的sql语句--急

<insert id="saveManyPopInfo" parameterType="java.util.List">
    insert into popinfo (popid,popname,remark)
    select seq_popid.nextval,p.* from (
    <foreach collection="list" item="pop" separator="union all">
        select #{pop.popname},#{pop.remark} from dual
    </foreach>
    ) p
</insert>
该代码可以实现批量新增的问题,但是我希望用的是union all的方法,即:
<insert id="saveManyPopInfo" parameterType="java.util.List">
           <!--这里的selectKey 感觉只是执行了一次,因为会报一个叫插入重复的错误-->
    <selectKey keyProperty="p1" order="BEFORE" resultType="int">
        select seq_popid.nextval from dual
    </selectKey>
    insert into popinfo (popid,popname,remark)
    <foreach collection="list" item="pop" separator="union all">
        select #{p1},#{pop.popname},#{pop.remark} from dual
    </foreach>
</insert>
    怎么可以用union all来解决批量新增的问题?


<!--这里的selectKey 感觉只是执行了一次,因为会报一个叫插入重复的错误-->

select seq_popid.nextval from dual

insert into popinfo (popid,popname,remark)

select #{p1},#{pop.popname},#{pop.remark} from dual


怎么可以用union all来解决批量新增的问题?

union all? 它不是用来合并数据的吗?基本用来查询。。。没听说过可以用来插入啊

批量插入么? 我写过一篇博客,关于ibatis批量插入,你看看吧http://blog.csdn.net/moneyshi/article/details/22807239

第一个插入不就是union all吗

separator="union all"已经是union all了啊