Returning Oracle SQL data as XML

An earlier post illustrated how to extract information from XML inside PL/SQL. This post is an example of the reverse of this, in that it shows how to create an XML document from a SQL statement. These examples are based on creating an XML document providing details of the tables in the SCOTT schema but could easily be adapted to suit your needs.

Extracting XML information using PL/SQL

Since version 9, Oracle has had support for XML data built into the heart of the database. Sometimes however, it is not immediately obvious how to get data from an XML string, particularly if, like me, it's not something you do that often!


  • oracle (8)
  • Mac OS (6)
  • Oracle (6)
  • SQL (5)
  • apex (4)
  • mac os (3)
  • iPhone (3)
  • script (2)
  • GIS (2)
  • map (2)