PL/SQL (MOSC)

MOSC Banner

Encode in UTF 8 using UTL_FILE function

edited Jul 9, 2018 5:03AM in PL/SQL (MOSC) 5 commentsAnswered

I'm trying to generate a text file in encode in UTF 8 format, the problem is when the size of the file goes above 800KB it gets encode in ANSI instead of UTF 8 format

unfortunately i can not use sqlplus spool option due to security policy.

Any input on this is highly appreciated.

OS : windows

db : tried both in 11g and 12c.

CREATE OR REPLACE Procedure SSSE

  As

   fDirectory varchar(30) := 'SSSD';

   CLIENT Utl_File.file_type;

   fLine NVarchar2(12767);

Begin

CLIENT := UTL_FILE.fopen(fDirectory,'Event'|| to_char(sysdate, '-mm-dd-yyyy HH24-MI-SS')||'.txt', 'w',32000);

      UTL_FILE.put_line(CLIENT,'Orderid'||chr(9)||'customername'||chr(9)||'Totalamount'||chr(9)||'Tax'||chr(9)||'DueDate'||chr(9)||'Deposit'||chr(9)||'Paymentdate');

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center