Home » SQL & PL/SQL » SQL & PL/SQL » File encoding UTL_FILE (Oracle Database 10g Enterprise Edition Release 10.2.0.4.0)
File encoding UTL_FILE [message #504077] Thu, 21 April 2011 07:41 Go to next message
Manoj.Gupta.91
Messages: 239
Registered: March 2008
Location: Delhi
Senior Member
Hi All,

I'm using

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

I'm creating a file using UTL_FILE.FOPEN and UTL_FILE.PUTF

But I don't know the file I created is in which encoding ASCII, UTF-8, EBCDIC etc.

1.) How can I create files in my desired encoding using UTL_FILE?
2.) Does UTL_FILE use database encoding? If yes then how to find out database encoding?
3.) Which encoding is used by UTL_FILE by default?

Thanks & Regards
Manoj
Re: File encoding UTL_FILE [message #504080 is a reply to message #504077] Thu, 21 April 2011 07:53 Go to previous messageGo to next message
Michel Cadot
Messages: 68770
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
What does say the documentation?
Maybe the safer way is to make some test by yourself.
And maybe you can help others posting your tests and results here.

Regards
Michel
Re: File encoding UTL_FILE [message #504213 is a reply to message #504080] Fri, 22 April 2011 03:19 Go to previous messageGo to next message
Manoj.Gupta.91
Messages: 239
Registered: March 2008
Location: Delhi
Senior Member
Hi,

I actually don't know the right way to find out any file's encoding. What I do is

1. Open that file in NOTEPAD.
2. Choose Save As from file menu.

It shows me the encoding. I assume that this is my file's encoding. I can change it from there also.
But I want my files to be automatically generated by UTL_FILE in my desired encoding.

Q1. Am I doing it in a right way to find out file's encoding? Please suggest me the right way. Any DOS command etc.

Q2. In documentation I didn't find default encoding style of a file generated using UTL_FILE. Can you help me to find out.

I've already searched in GOOGLE but didn't find any suitable answer.

Please help me to resolve this issue.

Thanks & Regards
Manoj
Re: File encoding UTL_FILE [message #504223 is a reply to message #504213] Fri, 22 April 2011 07:16 Go to previous messageGo to next message
ThomasG
Messages: 3212
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
The file be in the encoding correspondent to what NLS_LANG was set to on the OS where you started the procedure.

Also, depending on the content of the file, there are a lot of encodings that look pretty much identical unless there is a specific character in the file. For example an ASCII file and an UTF-8 are exactly identical when there are just "normal" letters and number in it. So it is not really possible to determine an encoding 100% sure only form a sample file. (unless EVERY character possible in an encoding is in the sample file)
Re: File encoding UTL_FILE [message #504240 is a reply to message #504223] Fri, 22 April 2011 15:55 Go to previous message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
http://developers.sun.com/global/technology/standards/reference/faqs/determining-file-encoding.html
Previous Topic: create table
Next Topic: "ORA-00942: table or view does not exist" even after GRANT
Goto Forum:
  


Current Time: Tue Sep 09 10:16:45 CDT 2025