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 -> Re: How to get Attributes in XML Output

Re: How to get Attributes in XML Output

From: Karsten Farrell <kfarrell_at_belgariad.com>
Date: Tue, 15 Apr 2003 19:44:05 GMT
Message-ID: <MPG.190600e22925c7c1989740@news.la.sbcglobal.net>


ryan_at_blackdogconsulting.com said...
> 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
>

You might try the following link (will probably wrap) to see if it satisfies your request:

http://asktom.oracle.com/pls/ask/f?p=4950:8:1090762::NO::F4950_P8 _DISPLAYID,F4950_P8_CRITERIA:470821346116, At the end of the article is a link where you can get a couple of Oracle utilities ... especially DBXML, which formats sql queries as xml. If you've already found this utility, then forget I said anything.

-- 
/Karsten
DBA > retired > DBA
Received on Tue Apr 15 2003 - 14:44:05 CDT

Original text of this message

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