oracle mybatis 批量插入 自增id

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

实现方案一:


    
        INSERT INTO WF_TASKTEMP_DEALSTAFF (DEAL_ID, TEMP_ID, STAFF_ID,DEAL_TYPE, STATUS)
        SELECT WF_TASKTEMP_DEALSTAFF$SEQ.NEXTVAL,a.* FROM (
        
            SELECT
            #{item.tempId,jdbcType=VARCHAR},
            #{item.staffId,jdbcType=VARCHAR},
            #{item.dealType,jdbcType=VARCHAR},
            #{item.status,jdbcType=CHAR}
            FROM dual
        
        ) a
    

实现方案二:

       
 
            begin
            
                insert into WF_TASKTEMP_DEALSTAFF
                (
                  DEAL_ID, TEMP_ID, STAFF_ID,DEAL_TYPE, STATUS
                )
                values(WF_TASKTEMP_DEALSTAFF$SEQ.nextval,
                    #{item.tempId,jdbcType=VARCHAR},
                    #{item.staffId,jdbcType=VARCHAR},
                    #{item.dealType,jdbcType=VARCHAR},
                    #{item.status,jdbcType=CHAR}
                );
            
            end;
        

转载于:https://my.oschina.net/u/3847203/blog/2967375

你可能感兴趣的:(oracle mybatis 批量插入 自增id)