0
我试图导入固定宽度的文本文件,但我遇到了非ascii特征数据的问题。以下是我可以创建的最小示例来演示问题。使用SQL Loader加载UTF8编码的固定宽度文本文件
load data
infile *
truncate into table test
(
txt position(1:3)
)
BEGINDATA
A
Ö
ABC
ÅÄÖ
下面是表:
create table test(
txt varchar2(30 char) not null
);
所有记录,但最后一个是进口的就好了。我猜它必须处理字节与char的语义。这是否可以解决我的问题? 甚至有可能在具有多字节字符数据的文件中讨论固定宽度记录?
这里是日志文件的相关部分:你希望有一定的宽度和应用的期待某些字段大小之间可能出现
SQL*Loader: Release 11.2.0.1.0 - Production on Mon May 29 10:30:04 2017
Control File: test.dat
Data File: test.dat
Bad File: test.bad
Discard File: none specified
(Allow all discards)
Number to load: ALL
Number to skip: 0
Errors allowed: 50
Bind array: 64 rows, maximum of 256000 bytes
Continuation: none specified
Path used: Conventional
Table TEST, loaded from every logical record.
Insert option in effect for this table: TRUNCATE
Column Name Position Len Term Encl Datatype
------------------------------ ---------- ----- ---- ---- ---------------------
TXT 1:3 3 CHARACTER
Record 4: Rejected - Error on table TEST, column TXT.
Multibyte character error.
Table TEST:
3 Rows successfully loaded.
1 Row not loaded due to data errors.
Space allocated for bind array: 384 bytes(64 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 4
Total logical records rejected: 1
Total logical records discarded: 0
这不是一个答案。你尝试过这个例子吗? – Ronnis
嗯,你尝试类似txt POSITION(1:9)CHAR – sandman
,并确保你的NLS_LANG设置为UTF8或OS的语言环境,这样oracle可以进行必要的多遍转换 – sandman