具体情况, 见附件, 附件内有截图。
问题:
Oralce 使用 sqlldr 导入数据 ,导入成功后,进入相关的表中查询为乱码。
A)Bss.ctl文件内容
load data
CHARACTERSET UTF8
infile 'bss.txt'
into table bss append
fields terminated by " "
(
phone_type char,
latn char,
telephone char,
modes char
)
B)Bss.txt文件内容
11 740 079800169025 虚
C) 在CMD 里运行
C:\>sqlldr [email protected]_aa bss.ctl log=bss09.lcls
remote_aa指在PL/sql 里配的服务名
D)进相关的表进行查询
select * from book
解决方法:
更改 Bss.ctl文件内容
load data
CHARACTERSET UTF8
infile 'bss.txt'
into table bss append
fields terminated by " "
(
phone_type char,
latn char,
telephone char,
modes char
)
改为
load data
CHARACTERSET ZHS16GBK
infile 'bss.txt'
into table bss append
fields terminated by " "
(
phone_type char,
latn char,
telephone char,
modes char
)
ZHS16GBK 来源于
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraClient10g_home1\