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: 146
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: 68718
Registered: March 2007
Location: Saint-Maur, France, https...
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: Sun Dec 01 12:23:48 CST 2024