Saving xmldom.DOMDocument to a file
697351Apr 24 2009 — edited Apr 27 2009Hi 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);
..
..
..