SQL * Loader无法识别分隔符“¥”

时间:2015-06-03 09:10:34

标签: oracle utf-8 delimiter sql-loader

尝试使用¥分隔符加载UTF-8文件时,它在找到字符时不会分隔字段。我们从超过列大小的值中得到ORA-12899错误,因为它试图将整行放入第一列。

在UTF-8中,¥Â¥(C2A5),但它似乎正在尝试查找C2C2A5。

数据库设置

NLS_LANGUAGE    SPANISH
NLS_TERRITORY   SPAIN
NLS_CURRENCY    ?
NLS_ISO_CURRENCY    SPAIN
NLS_NUMERIC_CHARACTERS  ,.
NLS_CHARACTERSET    WE8ISO8859P15
NLS_CALENDAR    GREGORIAN
NLS_DATE_FORMAT DD/MM/RR
NLS_DATE_LANGUAGE   SPANISH
NLS_SORT    SPANISH
NLS_TIME_FORMAT HH24:MI:SSXFF
NLS_TIMESTAMP_FORMAT    DD/MM/RR HH24:MI:SSXFF
NLS_TIME_TZ_FORMAT  HH24:MI:SSXFF TZR
NLS_TIMESTAMP_TZ_FORMAT DD/MM/RR HH24:MI:SSXFF TZR
NLS_DUAL_CURRENCY   ?
NLS_COMP    BINARY
NLS_LENGTH_SEMANTICS    BYTE
NLS_NCHAR_CONV_EXCP FALSE
NLS_NCHAR_CHARACTERSET  AL16UTF16
NLS_RDBMS_VERSION   11.2.0.3.0

我们尝试过:

NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
NLS_LANG=SPANISH_SPAIN.WE8MSWIN1252

我们正在使用西班牙语语言环境的Windows 7计算机上的命令窗口中运行SQL * Loader。

控制文件:

LOAD DATA
CHARACTERSET UTF8
INFILE  'C:\tmp\xxxy.txt'
BADFILE 'C:\tmp\xxxy.bad'
TRUNCATE INTO TABLE  SAMPLE.TEST_CAR_VENCIMI_INTERMED
fields terminated by "¥"
TRAILING NULLCOLS
(
CODE             CHAR "upper(ltrim(rtrim(:CODE)))",
CIF              CHAR "upper(ltrim(rtrim(:CIF)))",
CODIGO_PRESTAMO  CHAR "upper(ltrim(rtrim(:CODIGO_PRESTAMO)))"
)

示例数据文件:

21AK0100¥P11111111F¥910002¥000000000106013.64¥666666666¥mail@domain.com¥address¥11111¥Name¥Surname 1¥Surname 2¥mail2@domain.com¥666666666

1 个答案:

答案 0 :(得分:1)

由于您使用的是UTF8字符和UTF8文件格式(我认为),对于运行SQL * Loader的会话,请将NLS_LANG环境变量设置为“SPANISH_SPAIN.UTF8”。