一、Test Windos方式 declare# y: Z2 ^2 n$ D( x
maxrecords constant int:=100000;" G% k, j& Q4 [
i int :=1;
6 _1 _3 D/ Q5 P$ s! K5 ` begin& z' j u" N, _1 }: F' S
for i in 1..maxrecords loop7 a! l& M) ~. B$ J
insert into test25 M( s$ |4 x& ?0 Q
(id, name), P% u \8 l( B/ i
values- t1 p( V4 N+ t+ |! V
(test2_seq.nextval, to_char(9999+i));
l7 u/ A6 S! f M6 f( s- F end loop;
( e! g r+ w5 A2 L6 r8 \ dbms_output.put_line(' 成功录入数据!');
/ W4 d: g5 U) U ?" F commit;# A/ E X: v+ l( K
end;* d* y. z8 B8 S3 L7 q
二、从已有表中往入另一张表导数据
9 k3 P. Z# j9 T7 N$ ~2 v" } create or replace procedure TestProc is
5 ~$ X/ M! o* \" |, q! T begin! Z7 ]" ]# X& M5 N5 d
for c in(select id, name from test2) loop4 q5 |3 w+ h$ |7 W. m+ c' w
insert into test
* B6 `1 q A0 d% t. V" G# J (id,
% R( o+ T. V5 M5 ^9 [5 t name)/ g$ t7 J) S0 `; j; R
values
+ H4 L1 b) r. v! \$ q5 Y6 F; I5 O (test_seq.nextval, c.name);- t/ T3 m; Z! ^; u$ W, b
end loop;# p% t" r% N b9 A# C( X2 s
end TestProc; |