Home » Developer & Programmer » JDeveloper, Java & XML » Export into xml
Export into xml [message #343294] Tue, 26 August 2008 19:09 Go to next message
evergrean
Messages: 15
Registered: February 2008
Junior Member
I need to export 50 records from one table in Oracle 9i into an xml file. Each record has 5 fields.

Please advise if I can do that and what the command would be in sql plus.
Re: Export into xml [message #343352 is a reply to message #343294] Wed, 27 August 2008 00:44 Go to previous message
Michel Cadot
Messages: 58525
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
]
SQL> select dbms_xmlquery.getxml('select * from emp where rownum <= 3') from dual;
DBMS_XMLQUERY.GETXML('SELECT*FROMEMPWHEREROWNUM<=3')
--------------------------------------------------------------------------------------
<?xml version = '1.0'?>
<ROWSET>
   <ROW num="1">
      <EMPNO>7369</EMPNO>
      <ENAME>SMITH</ENAME>
      <JOB>CLERK</JOB>
      <MGR>7902</MGR>
      <HIREDATE>12/17/1980 0:0:0</HIREDATE>
      <SAL>800</SAL>
      <DEPTNO>20</DEPTNO>
   </ROW>
   <ROW num="2">
      <EMPNO>7499</EMPNO>
      <ENAME>ALLEN</ENAME>
      <JOB>SALESMAN</JOB>
      <MGR>7698</MGR>
      <HIREDATE>2/20/1981 0:0:0</HIREDATE>
      <SAL>1600</SAL>
      <COMM>300</COMM>
      <DEPTNO>30</DEPTNO>
   </ROW>
   <ROW num="3">
      <EMPNO>7521</EMPNO>
      <ENAME>WARD</ENAME>
      <JOB>SALESMAN</JOB>
      <MGR>7698</MGR>
      <HIREDATE>2/22/1981 0:0:0</HIREDATE>
      <SAL>1250</SAL>
      <COMM>500</COMM>
      <DEPTNO>30</DEPTNO>
   </ROW>
</ROWSET>

Regards
Michel
Previous Topic: count node in xmltype data
Next Topic: inserting data finto table from a clob column
Goto Forum:
  


Current Time: Thu Jul 24 06:00:03 CDT 2014

Total time taken to generate the page: 0.08753 seconds