一、Test Windos方式 declare5 e) ~: ^( n0 ?; p+ k
maxrecords constant int:=100000;: U6 t3 }+ Z E' N' f& @1 ?
i int :=1;+ o7 r0 W" E: B+ m, M# i- @- g5 a
begin
3 o# Y2 F, s7 I8 j2 p$ c0 c for i in 1..maxrecords loop
; {( X* z% e' k. u' b insert into test2# C" _; B. l( f8 G% c" E* f
(id, name)
3 }5 a' ?* m) {/ w% U5 \$ e values
% ]5 W* w- p- t9 W: C (test2_seq.nextval, to_char(9999+i));
3 U( O+ K2 K1 q: Q" L, @: d, b+ R end loop;8 C; c% O/ v4 F
dbms_output.put_line(' 成功录入数据!');) i" p$ Y; {( B
commit;4 z1 A0 o% G' M; T/ E
end;- B' j# Z6 Z) c7 c x) T% `1 `# d
二、从已有表中往入另一张表导数据& v" Z! N5 u" a
create or replace procedure TestProc is
Y& h: s' A) L7 t5 w$ ] begin
& {# k: C+ f, X, y2 h for c in(select id, name from test2) loop3 q/ s7 h- b9 I G
insert into test% [2 V( j& ]1 {
(id,
: N: j- Q2 _0 i, m- G j name)& D! [/ W j) }: ]* P0 x9 F, k
values% F5 |* y: v* f) m) W3 H
(test_seq.nextval, c.name);. m7 @) b$ y; l4 Q9 ^
end loop;: g+ S$ t/ n# r+ o5 f/ l) U( ]* t6 A
end TestProc; |