- 最后登录
- 2015-3-16
- 在线时间
- 22 小时
- 威望
- 0
- 金钱
- 72
- 注册时间
- 2012-6-29
- 阅读权限
- 10
- 帖子
- 18
- 精华
- 0
- 积分
- 0
- UID
- 548
|
4#
发表于 2012-12-27 13:37:55
CREATE TABLE "SMELTER"."IF_TEST_T"
("COL1" VARCHAR2(40),
"COL2" VARCHAR2(50),
"COL3" VARCHAR2(20),
"COL4" VARCHAR2(100),
"COL5" VARCHAR2(100),
"COL6" VARCHAR2(10),
"COL7" VARCHAR2(20),
"COL8" VARCHAR2(20),
"COL9" VARCHAR2(20),
"COl10" VARCHAR2(20),
"COL11" VARCHAR2(30),
"COL12" VARCHAR2(20),
"COL13" VARCHAR2(30),
"COL14" VARCHAR2(50),
"COL15" VARCHAR2(50),
"COL16" VARCHAR2(100),
"COL17" VARCHAR2(100),
"COL18" VARCHAR2(15)
)
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY "TEST"
ACCESS PARAMETERS
( RECORDS DELIMITED BY '\n' CHARACTERSET ZHS16GBK
BADFILE '2.bad' DISCARDFILE '2.dsc' LOGFILE '2.log' FIELDS TERMINATED BY '|' LDRTRIM
MISSING FIELD VALUES ARE NULL
( "COL1" CHAR(255)
TERMINATED BY '|'
,"COL2" CHAR(255)
TERMINATED BY '|'
,"COL3" CHAR(255)
TERMINATED BY '|'
,"COL4" CHAR(255)
TERMINATED BY '|'
,"COL5" CHAR(255)
TERMINATED BY '|'
,"COL6" CHAR(255)
TERMINATED BY '|'
,"COL7" CHAR(255)
TERMINATED BY '|'
,"COL8" CHAR(255)
TERMINATED BY '|'
,"COL9" CHAR(255)
TERMINATED BY '|'
,"COL10" CHAR(255)
TERMINATED BY '|'
,"COL11" CHAR(255)
TERMINATED BY '|'
,"COL12" CHAR(255)
TERMINATED BY '|'
,"COL13" CHAR(255)
TERMINATED BY '|'
,"COL14" CHAR(255)
TERMINATED BY '|'
,"COL15" CHAR(255)
TERMINATED BY '|'
,"COL16" CHAR(255)
TERMINATED BY '|'
,"COL17" CHAR(255)
TERMINATED BY '|'
,"COL18" CHAR(255)
TERMINATED BY '|'
)
)
LOCATION
( 'a.txt'
)
)
REJECT LIMIT UNLIMITED ;
控制文件:
load data
CHARACTERSET ZHS16GBK
infile '/etldata/sdata/dir0415/a.txt'
truncate
INTO TABLE ODS_MUSIC_COPYRIGHT_COD_tmp
FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"'
(
"COL1" CHAR(255)
TERMINATED BY '|'
,"COL2" CHAR(255)
TERMINATED BY '|'
,"COL3" CHAR(255)
TERMINATED BY '|'
,"COL4" CHAR(255)
TERMINATED BY '|'
,"COL5" CHAR(255)
TERMINATED BY '|'
,"COL6" CHAR(255)
TERMINATED BY '|'
,"COL7" CHAR(255)
TERMINATED BY '|'
,"COL8" CHAR(255)
TERMINATED BY '|'
,"COL9" CHAR(255)
TERMINATED BY '|'
,"COL10" CHAR(255)
TERMINATED BY '|'
,"COL11" CHAR(255)
TERMINATED BY '|'
,"COL12" CHAR(255)
TERMINATED BY '|'
,"COL13" CHAR(255)
TERMINATED BY '|'
,"COL14" CHAR(255)
TERMINATED BY '|'
,"COL15" CHAR(255)
TERMINATED BY '|'
,"COL16" CHAR(255)
TERMINATED BY '|'
,"COL17" CHAR(255)
TERMINATED BY '|'
,"COL18" CHAR(255)
TERMINATED BY '|'
)
是记录出现了错位。
外部表加载进去后是这样子的:
COL4 COL5 COL6 COL7
-------------------- ---------- ---------- ----------
爱而远之 任 A
而通过sqlloader加载记录是这样子的:
COL4 COL5 COL6 COL7
-------------------- ---------- ---------- ----------
爱而远之 任珅 A 2011-08-18
数据库版本: ORACLE 11R2, AIX RAC |
|