oracle_五千万数据插入测试

 1 --创建表 tab_a
 2 --  create table tab_a (id int primary key not null,pid int);
 3 --创建序列
 4 /**
 5  create sequence seq_a 
 6    increment by 1
 7    start with 1
 8    nomaxvalue
 9    nocycle
10    cache 20;
11    **/
12 --创建存储过程
13 create or replace procedure pro_a_insert is
14   i NUMBER(20);
15 begin
16   for i In 1 .. 1000000 loop
17     INSERT INTO tab_a
18     VALUES
19       (seq_a.nextval, i); IF mod
20       (i, 100) = 0 THEN COMMIT;
21   END IF;
22 END LOOP;
23 end pro_a_insert;
24 /
25 ---调用
26 
27 
28 Procedure created.
29 
30 
31 SQL> CREATE OR REPLACE PROCEDURE CallHelloWorld1 (
32   2    p_user  VARCHAR2
33   3  ) AS
34   4  BEGIN
35   5    -- 调用存储过程的 存储过程
36   6    HelloWorld1(p_user);
37   7  END CallHelloWorld1;
38   8  /
39 
40 
41 Procedure created.
42 
43 
44 执行
45 SQL> set serveroutput on
46 SQL> exec CallHelloWorld1( 'Tom' );
47 Hello Tom!
48 
49 
50 PL/SQL procedure successfully completed.
51 
52 
53 
54 create or replace procedure pro_a_insert is
55   i NUMBER(20);
56 begin
57   for i In 1 .. 10000000 loop
58     INSERT INTO tab_a
59     VALUES
60       (seq_a.nextval, i); IF mod
61       (i, 100) = 0 THEN COMMIT;
62   END IF;
63 END LOOP;
64 end pro_a_insert;
65 
66 
67  每 1000万插入一次 , 100  条提交一次

 

posted @ 2013-09-14 15:16  cphmvp  阅读(602)  评论(0编辑  收藏  举报
爬虫在线测试小工具: http://tool.haoshuju.cn/