记工作需要用到的一个批量插入数据的脚本。
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;