oracle批量增加數據
記工作需要用到的一個批量插入數據的腳本。
declare
code_ number(10) := 100000;
num_ number(10) := 2000000;
error_message exception;
begin
for i in 100 .. 1000 loop
num_ := num_ + 1;
code_ := code_ + 1;
insert into tpj_gf_ma_invoiceinfo
values
(i,
num_,
code_,
);
end loop;
commit;
end;
再次改進:
declare
code_ number(10) := 100000;
num_ number(10) := 2000000;
error_message exception;
begin
for j in 1 .. 4 loop
for i in 100 .. 1000 loop
num_ := num_ + 1;
code_ := code_ + 1;
insert into tpj_gf_ma_invoiceinfo
values
(i,
num_,
code_,
‘6‘,
‘‘,
‘‘,
‘‘,
‘test‘,
‘0‘,
‘‘,
‘未使用‘);
end loop;
end loop;
for j in 1 .. 6 loop
for i in 100 .. 1000 loop
num_ := num_ + 1;
code_ := code_ + 1;
insert into tpj_gf_ma_invoiceinfo
values
(i,
num_,
code_,
‘6‘,
‘600‘,
‘99400‘,
‘111000‘,
‘test‘,
‘0‘,
‘123665488‘,
‘‘,
‘未使用‘);
end loop;
end loop;
commit;
end;
oracle批量增加數據