简体   繁体   English

使用SQL * Loader加载货币符号

[英]Loading currency symbols using SQL*Loader

I am trying to load a csv file with currency symbols, using SQL*Loader. 我正在尝试使用SQL * Loader加载带货币符号的csv文件。 The symbol '£' gets replaced by '#' and symbol '€' gets replaced by NULL. 符号'£'被'#'替换,符号'€'被NULL替换。

Not sure if I should tweak some settings in my control file? 不确定我是否应该在控制文件中调整一些设置?

Here are the values from NLS_DATABASE_PARAMETERS: 以下是NLS_DATABASE_PARAMETERS中的值:

NLS_NCHAR_CHARACTERSET = AL16UTF16  
NLS_CHARACTERSET = AL32UTF8

Any pointers would be of great help. 任何指针都会有很大的帮助。

Extract of csv file - csv文件的摘录 -

id,currency
1234,£
5678,€

Datatype of the column for currency is NVARCHAR2(10). 货币列的数据类型为NVARCHAR2(10)。

Here's the ctl file - 这是ctl文件 -

OPTIONS(skip=1)
LOAD DATA
TRUNCATE
INTO TABLE schema_name.table_name
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(
filler1 filler,
filler2 filler,
Id INTEGER EXTERNAL,
Currency CHAR "TRIM(:Currency)"
)

I guess this is a character set problem. 我猜这是一个字符集问题。

Did you set the character set of the sqlloader file to UTF8? 您是否将sqlloader文件的字符集设置为UTF8?

CHARACTERSET UTF8

Also, is the file itself UTF8 encoded? 此外,文件本身是UTF8编码的吗?

Thanks Justin and Patrick for the pointer! 感谢贾斯汀和帕特里克的指针!

The file was not UTF-8 encoded. 该文件不是UTF-8编码的。 I converted the file to UTF-8 encoding and it worked! 我将文件转换为UTF-8编码,它工作正常!

For those who don't know how to convert the file's encoding using Notepad++ (like me, I just learned how to do it) : Create a new file in Notepad++ -> Go to Encoding -> Encode in UTF-8 -> Copy-paste the contents -> save the file as .csv 对于那些不知道如何使用Notepad ++转换文件编码的人(像我一样,我刚刚学会了如何操作):在Notepad ++中创建一个新文件 - >转到编码 - >以UTF-8编码 - >复制 - 粘贴内容 - >将文件保存为.csv

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM