1

What is the best way to insert into a table. I have to insert 10,00,000 plus records in a bulk fashion. The approach which I am using right now is many simple inserts.

insert into Table1 values ('1','2','3','4');
insert into Table1 values ('5','2','7','4');
insert into Table1 values ('9','1','3','4');
..............
..............
.........
commit;

Is there a better way of doing this in 10g? Can I do this in a PL/SQL ?

I am pretty new to Oracle.

4

1 回答 1

3

由于您从一个分隔的文本文件开始,您应该摆脱sed调用并简单地使用SQL*Loader 实用程序将数据加载到数据库中(您也可以将文件复制到数据库服务器,然后使用外部表将具有非常相似的语法)。您的控制文件最终可能与本示例非常相似。对列的长度进行一些疯狂的猜测,控制文件将类似于

load data
infile '<<name of your data file>>
into table <<name of your table>>
fields terminated by '|' 
(col1 char(5),
 col2 char(7),
 col3 char(9),
 col4 char(11),
 col5 char(13))
于 2012-09-18T22:57:05.497 回答