| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: UTL_FILE replaces 0A by 0D 0A
metzguar schrieb:
> Maxim Demenko schrieb:
>
>> 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
IIRC, there is no workaround on windows until 10g for your problem (by
means of utl_file - one possibility would be with a java stored procedure).
See
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:6379798216275
Best regards
Maxim Received on Thu Sep 14 2006 - 05:58:10 CDT
![]() |
![]() |