Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a table say SCOTT.DEPT and I want to convert it into an XML document. Is there anyway to accomplish this task?

Kind Regards,

share|improve this question
up vote 0 down vote accepted

The easiest way to do this is:

select dbms_xmlgen.getxml( 'select * from dept') as xml 
from dual;

There are other way more complicated ways of achieving similar results, but the answer would be significantly longer!

share|improve this answer
Thanks buddy. Its done with your example. – Memon Feb 5 '14 at 11:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.