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;

oracle 批量插入-支持序列自增

注意:每个值后面跟对应别名,别名对应数据库字段名。 

 

3、查看插入结果

select * from test_batch;

oracle 批量插入-支持序列自增

 

查看ibatis+oracle批量插入请进入另一个帖子:【oracle+ibatis 批量插入-支持序列自增

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
  • 2022-02-24
  • 2022-01-03
  • 2022-01-22
  • 2021-11-17
猜你喜欢
  • 2022-12-23
  • 2021-06-10
  • 2022-12-23
  • 2021-08-17
  • 2022-12-23
  • 2022-12-23
  • 2021-05-26
相关资源
相似解决方案