Home » SQL & PL/SQL » SQL & PL/SQL » Writing Arabic Text using UTL_FILE (Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production)
Writing Arabic Text using UTL_FILE [message #671911] Mon, 24 September 2018 01:28 Go to next message
chat2raj.s
Messages: 135
Registered: October 2010
Location: Chennai, India
Senior Member
I need to write arabic text in .txt file by using the following program but the output is just inverted Question marks.
DECLARE
  FILE_NAME            VARCHAR2(255);
  SVCFILE              UTL_FILE.FILE_TYPE;
  LINEBUF              VARCHAR2(32767);
  DIRNAME              VARCHAR2(255);
BEGIN
  FILE_NAME := TO_CHAR(SYSDATE, 'YYYYMMDDHH24MI') || '.TXT';
  SVCFILE   := UTL_FILE.FOPEN('USER_DIR', FILE_NAME, 'W');
  DBMS_OUTPUT.PUT_LINE('Process Started at '||SYSDATE);
  LINEBUF := 'Testing Arabic text (النص العربي) exporting to Text File';
  UTL_FILE.PUT_LINE(SVCFILE, unistr(LINEBUF));
  UTL_FILE.FCLOSE(SVCFILE);
  DBMS_OUTPUT.PUT_LINE('Process Completed at '||SYSDATE);
EXCEPTION
  WHEN NO_DATA_FOUND THEN
    UTL_FILE.FCLOSE(SVCFILE);
    DBMS_OUTPUT.PUT_LINE('NO_DATA_FOUND ERROR '||SQLERRM);  
  WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('ERROR IN UTL_FILE '||SQLERRM);  
END;
Re: Writing Arabic Text using UTL_FILE [message #671919 is a reply to message #671911] Mon, 24 September 2018 06:05 Go to previous messageGo to next message
msol25
Messages: 396
Registered: June 2011
Senior Member
Hi,

I have done once for reading Arabic character in text file. Please login to putty and do the following settings:

Right click on putty -> Change settings -> Translation -> Select Remote character set as "Win 1256".

After doing this I hope you can see Arabic characters in text file with correct format.

[Updated on: Mon, 24 September 2018 06:05]

Report message to a moderator

Re: Writing Arabic Text using UTL_FILE [message #673624 is a reply to message #671919] Tue, 27 November 2018 23:32 Go to previous message
chat2raj.s
Messages: 135
Registered: October 2010
Location: Chennai, India
Senior Member
I have changed the NLS_CHARACTER_SET and the server language settings to support arabic and now the text file shows me arabic text, although sometimes they are looking arabic but it is a junk.
Previous Topic: DBMS_SCHEDULER
Next Topic: Materialised Views - FAST Refresh
Goto Forum:
  


Current Time: Fri Aug 07 23:21:56 CDT 2020