How do you create an XML document using SQL

From: DaveS <dsistare_at_ledgelight.com>
Date: 29 Jun 2004 13:14:50 -0700
Message-ID: <85db8ae7.0406291214.3dc39758_at_posting.google.com>



Hello,

I'm using Oracle 9.2 and would like to automatically save a copy of each deleted record in XML format to another database table. There would be one XML record for each deleted record. I'd like to store the XML record in a CLOB. I've created a table and added a trigger to capture the delete event but I'm not sure how to create the XML document. Each deleted record is comprised of a single row from a parent table and multiple rows from a child table. Heres the catch; I don't want the solution to require me to specify each individual column in each table. I'd like to use the wildcard(*) operator to select the columns. The Oracle documentation I've read says to use objects to create complex XML but you can't use the wildcard operator to specify the columns. I've looked at using dbms_xmlgen which supports the wildcard operator but I can't create a well formed XML document. Any ideas or examples would be greatly appreciated.

Thanks Received on Tue Jun 29 2004 - 22:14:50 CEST

Original text of this message