Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CLOB to file via UTL_FILE

570 views
Skip to first unread message

webtourist

unread,
Dec 23, 2008, 4:30:57 PM12/23/08
to
I have large CLOB (XML) (way bigger than 32K) data that has NO
LINEBREAK/NL.....

I want to write the CLOBs to files.
Using UTL_FILE...is there anyway to avoid newline --- so that the
file size = LOB length ?

If not, is there another option ?

thanks

Mladen Gogala

unread,
Dec 23, 2008, 6:03:20 PM12/23/08
to

DBMS_LOB package can do that.

--
http://mgogala.freehostia.com

Vladimir M. Zakharychev

unread,
Dec 24, 2008, 11:03:22 AM12/24/08
to

UTL_FILE.PUT() does not append newline characters, just make sure you
do not write more than the buffer size specified to UTL_FILE.FOPEN()
without flushing with UTL_FILE.FFLUSH(). For example,

declare
f UTL_FILE.FILE_TYPE;
cpos pls_integer := 1;
begin
f := utl_file.fopen('SOMEDIR', 'somefile.xml', 'w' , 16386);
while cpos < dbms_lob.getlength(:clob) loop
utl_file.put(f,dbms_lob.substr(:clob, 16386, cpos));
cpos := cpos + 16386;
utl_file.fflush(f);
end loop;
utl_file.fclose(f);
end;

Hth,
Vladimir M. Zakharychev
N-Networks, makers of Dynamic PSP(tm)
http://www.dynamicpsp.com

0 new messages