mybatis中 mysql 和orcale批量插入

1.先写在orcale中的批量插入

xml:

 
 insert into User (ID, NAME, AGE,BIRTHDAY) 
  
select
#{item.id,jdbcType=VARCHAR},
#{item.name,jdbcType=VARCHAR},
#{item.age,jdbcType=VARCHAR},
#{item.birthday,jdbcType=VARCHAR}
 from dual 

 
  
 可以在orcale客户端试一下: 
  

insert into User 
(id, name, age,birthday) 
(
select '6', 'ddd', '123','1323-2-3'from dual union 
select '7', 'ddd', '123','1323-2-3' from dual union 
select '8', 'ddd', '123','1323-2-3' from dual 
)

mysql的xml:


insert into User
(ID, NAME, AGE,BIRTHDAY) 
		values
		
('${item.id}','${item.name}','${item.age}','${item.birthday}')
		
	

oracle自增序列,批量插入

	
          
         SELECT vouchersummary_sequence.Nextval as fid from DUAL  
         
		insert into voucherSummary ( fvoucherCode,foriginCode)
		
			select
			#{item.fvoucherCode,jdbcType=VARCHAR},
			#{item.foriginCode,jdbcType=VARCHAR}
			from dual
		
	



你可能感兴趣的:(mybatis中 mysql 和orcale批量插入)