使用sqlldr装载数据的简单例子

创建测试表:
create table DEMO
(
  DEPTNO NUMBER(2) not null,
  DNAME  VARCHAR2(14),
  LOC    VARCHAR2(13)
);[@more@]

例子1:装载定界数据类型为csv(Comma-Separated Value)

C:sqlldr userid=scott/tiger control=load.ctl data=data.csv direct=y

load.ctl内容如下:

LOAD DATA                                                 
INFILE *                                                  
INTO TABLE DEMO                                           
TRUNCATE                                                   
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'       
(DEPTNO,
DNAME,
LOC

数据文件data.csv的内容如下:

"10","ACCOUNTING","NEW YORK"
"20","RESEARCH","DALLAS"
"30","SALES","""CHICAGO"""
"40","OPERATIONS","BOSTON"
"50","","Virginia"
"60",,"Virginia"

例子2:装载定界数据类型为tsv(制表符分隔)

C:sqlldr userid=scott/tiger control=load.ctl data=data.tsv direct=y

load.ctl内容如下:

LOAD DATA                                                 
INFILE *                                                  
INTO TABLE DEMO                                           
TRUNCATE                                                   
FIELDS TERMINATED BY X'09'
(DEPTNO,
DNAME,
LOC
)

数据文件data.tsv的内容如下:

10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES "CHICAGO"
40 OPERATIONS BOSTON
50  Virginia
60  Virginia

注意:连续两个制表符表示中间的列为空

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/3898/viewspace-787851/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/3898/viewspace-787851/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值