Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2008-06-13
4
1,202 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 500 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

829 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