ORACLE 批量插入-支援序列自增
阿新 • • 發佈:2022-05-11
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.html1、建立表、序列
-- 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