Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> How to get Attributes in XML Output

How to get Attributes in XML Output

From: Ryan <ryan_at_blackdogconsulting.com>
Date: 15 Apr 2003 09:40:10 -0700
Message-ID: <bbfe1f32.0304150840.7ad780a7@posting.google.com>


I've seen plenty of examples that show how to query tables and get results such as the following, where the data is shown in elements:

<ROWSET>
<ROW num="1">
<CUSTOMER>
<CUSTOMERID>1044</CUSTOMERID>
<FIRSTNAME>Paul</FIRSTNAME>
<LASTNAME>Astoria</LASTNAME>
<HOMEADDRESS>
<STREET>123 Cherry Lane</STREET>
<CITY>SF</CITY>
<STATE>CA</STATE>
<ZIP>94132</ZIP>
</HOMEADDRESS>
</CUSTOMER>
</ROW>
</ROWSET>

My question is, how do I get the data in attributes? Is it even possible? I'm familiar with using FOR XML in MS SQL, but have not come across a similar procedure in Oracle 8i or 9i. An example of the output using the above example would be:

<ROWSET>
<ROW num="1">
<CUSTOMER CUSTOMERID="1044" FIRSTNAME="Paul" LASTNAME="Astoria">
<HOMEADDRESS STREET="123 Cherry Lane" CITY="SF" STATE="CA"
ZIP="94132">
</HOMEADDRESS>
</CUSTOMER>
</ROW>
</ROWSET>

I hope that makes sense. Thanks.

Ryan Received on Tue Apr 15 2003 - 11:40:10 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US