Home » SQL & PL/SQL » SQL & PL/SQL » dbms_xmldom.writetofile(DOMDocument,path)
dbms_xmldom.writetofile(DOMDocument,path) [message #397117] Thu, 09 April 2009 02:03 Go to next message
ramya29p
Messages: 100
Registered: November 2007
Location: Chennai
Senior Member
Hi,
I have tried the Following PL/SQL Code.
declare
doc dbms_xmldom.DOMDocument;
xt xmltype;
cursor cur1 is 
select xmlconcat(xmlelement("EDETAILS",xmlelement("EMPNO",empno),xmlelement("EMPNAME",ename))) from emp;
begin
open cur1;
loop
fetch cur1 into xt;
exit when cur1%notfound;
doc := dbms_xmldom.newDOMDocument(xt);
dbms_xmldom.writetofile(doc,'/tmp/s1.txt');
end loop;
close cur1;
end;

Emp table has 5 Records .
   	EMPNO	ENAME
1	8786	BALU
2	85978	RAMESH
3	23	23
4	555	RAJ
5	7678	BALAJI

but all the 5 records are not writing into the file. The file is having only 1 record
<EDETAILS>
  <EMPNO>7678</EMPNO>
  <EMPNAME>BALAJI</EMPNAME>
</EDETAILS>
can anyone tell me what i have to do to display all 5 records in the file?

[Updated on: Thu, 09 April 2009 02:07]

Report message to a moderator

Re: dbms_xmldom.writetofile(DOMDocument,path) [message #397120 is a reply to message #397117] Thu, 09 April 2009 02:16 Go to previous message
Michel Cadot
Messages: 64131
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I'm not sure but I think you overwrite your file at each loop and so only have the last row in it.

Regards
Michel
Previous Topic: Raise_Application_Error
Next Topic: CONNECT BY PRIOR
Goto Forum:
  


Current Time: Wed Dec 07 12:38:14 CST 2016

Total time taken to generate the page: 0.10914 seconds