Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Saving xmldom.DOMDocument to a file

697351Apr 24 2009 — edited Apr 27 2009
Hi all!

I have a problen saving an XML file generated from a SQL sentence in my Oracle 9i Database when the file is higer than 32K bytes.

To save file i use UTL_FILE library and i have found that there is the problem.

The code i use is the following:

CREATE OR REPLACE PROCEDURE SIGADMIN.PRUEBA_CAUC0004_EXT AUTHID CURRENT_USER IS
xml clob;
vxml varchar2(100);
..
..
xfile utl_file.file_type;
doc xmldom.DOMDocument;
..
..
BEGIN
..
..

--Inicializamos el CLOB
DBMS_LOB.CreateTemporary(xml,TRUE);
..
..

--Pasar el DOM document a CLOB
xmldom.writeToClob(doc,xml);

xfile := utl_file.fopen('TEMP_DIR','PRUEBA_CAUC0004.xml','w');
..
..
WHILE (pos < len) LOOP
vxml := dbms_lob.substr(xml,100,pos);
utl_file.put(xfile,vxml);

pos := pos+100;
END LOOP
--Liberamos los recursos
xmldom.freeDocument(doc);
utl_file.fclose(xfile);
..
..
..
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 25 2009
Added on Apr 24 2009
3 comments
3,746 views