读书人

将记事簿文件批量调入oracle

发布时间: 2012-09-28 00:03:35 作者: rapoo

将记事本文件批量调入oracle
1、在Oracle中创建临时表。

create table test
(
ID number(20),
IP varchar(20)
);
2:在d盘中创建test.txt,内容大致如下
ID IP
1 192.168.3.2
2 192.187.12.2
...............
注意,上面记事本文件以什么形式分隔,下面fields terminated by ' ' TRAILING NULLCOLS的单引号就以什么分隔
3、创建loaddata.ctl文件,保存在c盘,内容如下:

LOAD DATA
infile 'd:\test.txt'
into table test
truncate
fields terminated by ' ' TRAILING NULLCOLS
(
ID,
IP )所创建的列
4:cmd下顺序执行下列文件
cmd:

sqlldr userid=用户名/密码@数据库

c:\insert\loaddata_ip.ctl

读书人网 >其他数据库

热点推荐