Home » RDBMS Server » Server Administration » UTL_FILE and SQL_LANG
UTL_FILE and SQL_LANG [message #112528] Sat, 26 March 2005 15:17 Go to next message
casado
Messages: 2
Registered: March 2005
Junior Member
Hello All,

1) Config
WinXp (Portuguese) SP1 running both:
Oracle Server 9.2.0.1.0
Oracle Client

2) CharSets
Windows codepage = 1252
Environment NLS_LANG = BRAZILIAN PORTUGUESE_BRAZIL.WE8MSWIN1252
NLS_LANG in HOME0 = BRAZILIAN PORTUGUESE_BRAZIL.WE8MSWIN1252
NLS_LANG in HOME1 = BRAZILIAN PORTUGUESE_BRAZIL.WE8MSWIN1252
and
select * from nls_database_parameters
returns NLS_CHARACTERSET = AL32UTF8

3) Problem
I wrote a procedure that uses UTL_FILE to read lines from a text file. As the text file contains portuguese accented characters, I get inverted ? in line_buffer after a GET_LINE command.

This is because Oracle tries to read a WE8MSWIN1252 text file as if it were AL32UTF8.

changing
Environment NLS_LANG to BRAZILIAN PORTUGUESE_BRAZIL.AL32UTF8
NLS_LANG in HOME0 to BRAZILIAN PORTUGUESE_BRAZIL.AL32UTF8
NLS_LANG in HOME1 to BRAZILIAN PORTUGUESE_BRAZIL.AL32UTF8

solves the problem, but then client applications (sqlplus, sqlplusw and PL/SQL Developer) show Oracle messages (and menu items) with wrong characters in plece of the portuguese accented ones.

Changing the database NLS_CHARACTERSET to WE8MSWIN1252, although feasible, could create problems with a java application that accesses Oracle and uses Unicode.

So, it looks like I´m trapped btw choosing to have the Oracle Client NLS_LANG not match the Windows codepage OR to have the Oracle Client NLS_LANG not match the database NLS_CHARACTERSET.

Is there something I could fix in my UTL_FILE procedure to read the text file correctly ?

Best Regards,

Cesar Casado





Re: UTL_FILE and SQL_LANG [message #112771 is a reply to message #112528] Tue, 29 March 2005 05:07 Go to previous messageGo to next message
skooman
Messages: 913
Registered: March 2005
Location: Netherlands
Senior Member
No experience with it, but did you try to change NLS setting with ALTER SESSION (so, just for the time being, during the load of that file)?
Re: UTL_FILE and SQL_LANG [message #112795 is a reply to message #112771] Tue, 29 March 2005 07:39 Go to previous messageGo to next message
casado
Messages: 2
Registered: March 2005
Junior Member
Oops! Sorry for the typo in the Topic Title (I meant NLS_LANG).

Actually NLS_LANG is not an available parameter in ALTER SESSION.

Thanks.

Cesar Casado
Re: UTL_FILE and SQL_LANG [message #112903 is a reply to message #112795] Tue, 29 March 2005 17:00 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
This isn't really a great solution, but maybe something to consider if all else fails...

When you submit a DBMS_JOB, it stores all the environmental NLS settings (see user_jobs.nls_env). You could try submitting a periodic dbms_job from a session with the environment you want - to do the loading into a table. Clients accessing the table would use their own NLS settings.
Previous Topic: example01.dbf and temp01.dbf
Next Topic: Sizing Archive Logs
Goto Forum:
  


Current Time: Fri Jan 10 04:42:04 CST 2025