Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

oracle, database, 10, export table result set into xml

Posted on 2008-06-13
4
Medium Priority
?
1,209 Views
Last Modified: 2013-12-19
folks

how do i export a table content in oracle into a batch xml format?

all help will do

r
0
Comment
Question by:rutgermons
  • 2
4 Comments
 
LVL 16

Expert Comment

by:Milleniumaire
ID: 21778530
Use package DBMS_XMLGEN. This one very nicely converts contents of a table to XML. If you have hierarchy, use nested tables and Oracle objects.
0
 
LVL 29

Expert Comment

by:MikeOM_DBA
ID: 21778686
Try something like:

set pages 0 head off feed off long 32000 longc 32000
Select DBMS_XMLGEN.GETXML ('select empno,ename,job,deptno from emp')
  from dual;

Open in new window

0
 

Author Comment

by:rutgermons
ID: 21781269
thats mike

however how do i add a where clause into this query as when i run

Select DBMS_XMLGEN.GETXML ('select wonum from workorder where status ='COMP')
  from dual;

then i get a missing right parenthesis error

all help will do
0
 
LVL 29

Accepted Solution

by:
MikeOM_DBA earned 2000 total points
ID: 21781471
To include single quotes in query, put them twice:

Select DBMS_XMLGEN.GETXML (
      'select wonum from workorder where status =''COMP''')
  from dual;

Open in new window

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses
Course of the Month21 days, 1 hour left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question