domingo, 14 de julio de 2024

Insertar símbolo de euro con Oracle SQL LOAD

I'm loading a csv file using sqlldr. the file contains the symbol "€" which is inserted into a VARCHAR2 column. After the load, the database displays '¿' instead of the euro symbol. I have specified the characterset in the control file during the load:


LOAD DATA 

CHARACTERSET WE8MSWIN1252

I'm runing all of this on a Solaris machine, which by the way can't display the '€' symbol, I gives me a '.' instead when I hit the key to get the €.


We are using the data for BI purposes, so we have to keep the varchar2 column, even though changing its type to nvarchar2 inserts the € symbol correctly.

Can you suggest any other solution for the issue?

When I run locale command on the machin, I get :


LANG=

LC_CTYPE="C"

LC_NUMERIC="C"

LC_TIME="C"

LC_COLLATE="C"

LC_MONETARY="C"

LC_MESSAGES="C"

LC_ALL=

and my NLS DATABASE PARAMETERS Are:


NLS_NCHAR_CHARACTERSET  AL16UTF16

NLS_LANGUAGE    AMERICAN

NLS_TERRITORY   AMERICA

NLS_CURRENCY    $

NLS_ISO_CURRENCY    AMERICA

NLS_NUMERIC_CHARACTERS  .,

NLS_CHARACTERSET    WE8DEC

NLS_CALENDAR    GREGORIAN

NLS_DATE_FORMAT DD-MON-RR

NLS_DATE_LANGUAGE   AMERICAN

NLS_SORT    BINARY

NLS_TIME_FORMAT HH.MI.SSXFF AM

NLS_TIMESTAMP_FORMAT    DD-MON-RR HH.MI.SSXFF AM


I have tried setting the NLS_LANG variable, but nothing seems to work. 


RESPUESTA:


Your database is not configured to support the Euro character in a VARCHAR2 column. Your database's NLS_CHARACTERSET of WE8DEC means that it uses the old DEC MCS character set. That character set long predates the Euro character (it's even older than the ISO 8859-1 character set that also predates the Euro). So you can't validly store a Euro character in a VARCHAR2 column in your database.

You could change the database character set to something that supports the Euro character. There are many such character sets but I would guess that ISO-8859-15, Windows-1252, or UTF-8 would be the easiest migrations. Personally, I'd always prefer Unicode (UTF-8 which is the AL32UTF8 character set in Oracle) but you may have a reason to prefer a single-byte character set. Alternatively, you could declare this column (and any others that need to use the Euro character) to be NVARCHAR2 columns since your national character set supports Unicode. Supporting NVARCHAR2 columns may require changes to your front-end applications. If you can change the database character set, that would be my strong preference over adding NVARCHAR2 columns.


Fuentes.

Artículo:   "Euro '€' symbol not inserted correctly during Oracle SQL LOAD" Publicado en https://stackoverflow.com/ el  28-05-2015. Consultado el 30/06/2024.

URL: https://stackoverflow.com/questions/30512244/euro-%e2%82%ac-symbol-not-inserted-correctly-during-oracle-sql-load

No hay comentarios:

Publicar un comentario