1、创建表、序列
-- Create table create table test_batch ( id number not null, name varchar2(20), account varchar2(20) ) -- Create sequence create sequence seq_test_batch minvalue 1 maxvalue 9999999999999999999 start with 1 increment by 1 cache 20;
2、批量插入SQL
insert into test_batch(id, name, account) select seq_test_batch.nextval, name, account from( select 'frank' as name , 'frank001' as account from dual union select 'quanbs' as name , 'quanbs001' as account from dual ); commit;
注意:每个值后面跟对应别名,别名对应数据库字段名。
3、查看插入结果
select * from test_batch;
查看ibatis+oracle批量插入请进入另一个帖子:【oracle+ibatis 批量插入-支持序列自增】
转自:https://www.cnblogs.com/frank-quan/p/6044229.html