oracle批量导入测试数据
一、Test Windos方式
declare
maxrecords constant int:=1000;
i int :=1;
begin
for i in 1..maxrecords loop
insert into test2
(id, name)
values
(test2_seq.nextval, to_char('9999'+i));
end loop;
dbms_output.put_line(' 成功录入数据! ');
commit;
end;
二、从已有表中往入另一张表导数据
create or replace procedure TestProc is
begin
for c in(select id, name from test2) loop
insert into test
(id,
name)
values
(test_seq.nextval,
c.name);
end loop;
end TestProc;
declare
maxrecords constant int:=1000;
i int :=1;
begin
for i in 1..maxrecords loop
insert into test2
(id, name)
values
(test2_seq.nextval, to_char('9999'+i));
end loop;
dbms_output.put_line(' 成功录入数据! ');
commit;
end;
二、从已有表中往入另一张表导数据
create or replace procedure TestProc is
begin
for c in(select id, name from test2) loop
insert into test
(id,
name)
values
(test_seq.nextval,
c.name);
end loop;
end TestProc;
本文介绍两种Oracle数据库中批量导入测试数据的方法:一是通过PL/SQL块循环插入数据;二是从一个现有表中读取数据并插入到另一个表中。这两种方法能够高效地完成大量数据的批量导入工作。
2153

被折叠的 条评论
为什么被折叠?



