Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: UTL_FILE replaces 0A by 0D 0A

Re: UTL_FILE replaces 0A by 0D 0A

From: Maxim Demenko <mdemenko_at_arcor.de>
Date: Thu, 14 Sep 2006 11:19:55 +0200
Message-ID: <45091ee7$0$18487$9b4e6d93@newsspool3.arcor-online.net>


Urs Metzger schrieb:
> Connor McDonald schrieb:

>> Kalle Heuwes wrote:
>>> Hi, Urs !
>>>
>>> Unfortunately it also happens with UTL_FILE.put.
>>> Besides it is not only appended at the end of a row; it is even
>>> replaced in the middle of a string:
>>>
>>> DECLARE
>>>    lc_filename   VARCHAR2 (100)     := 'test.txt';
>>>    lt_file       UTL_FILE.file_type;
>>> BEGIN
>>>    lt_file := UTL_FILE.fopen ('EXPORT', lc_filename, 'w');
>>>    UTL_FILE.put(lt_file, 'hgfxxx' || CHR(10) || 'xxxgjhg');
>>>    UTL_FILE.fclose (lt_file);
>>> END;
>>>
>>> Kind regards
>>> Kalle
>>
>> any joy with put_raw ?

> Yeah! Joy!!
>
> SQL> declare
> 2 text varchar2(20) := 'ab' || chr(10) || 'cd';
> 3 file_a utl_file.file_type;
> 4 file_b utl_file.file_type;
> 5 begin
> 6 -- This won't work
> 7 file_a := utl_file.fopen('D_TEMP', 'file_a', 'w');
> 8 utl_file.put(file_a, text);
> 9 utl_file.fclose(file_a);
> 10 -- This works! Mode must be 'wb'!
> 11 file_b := utl_file.fopen('D_TEMP', 'file_b', 'wb');
> 12 utl_file.put_raw(file_b, utl_raw.cast_to_raw(text));
> 13 utl_file.fclose(file_b);
> 14 end;
> 15 /
>
> file_a: 61 62 0D 0A 63 64 0D 0A
>
> file_b: 61 62 0A 63 64
>
> Urs Metzger

I don't have right now a windows installation to test, but i was pretty sure, "WB" came only in 10g, was i wrong on it ?

Best regards

Maxim Received on Thu Sep 14 2006 - 04:19:55 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US