Re: Question about XML and Oracle.
From: Gerard H. Pille <ghp_at_skynet.be>
Date: Thu, 02 Dec 2010 21:06:38 +0100
Message-ID: <4cf7fc4a$0$14255$ba620e4c_at_news.skynet.be>
John Peterson wrote:
>
> "Gerard H. Pille" <ghp_at_skynet.be> wrote in message news:4ce6b41f$0$14255$ba620e4c_at_news.skynet.be...
>>
>> SELECT XMLROOT ( XMLElement("OuterElement",
>> "<AllMyQueryResultsXML/>"
>> ), VERSION '1.0', STANDALONE YES)
>> AS "XMLROOT" FROM DUAL;
>>
>>
>
> Thanks Gerald -- but I can't seem to figure out how to structure the query inside of the outer
> query. Maxim's reply seems to be (sort of) working for me, so I'll probably go that route.
<?xml version="1.0" standalone="yes"?>
<OuterElement>
</Topic>
<Topic>
</Topic>
<Topic>
</Topic>
<Topic>
</Topic>
</OuterElement>
Date: Thu, 02 Dec 2010 21:06:38 +0100
Message-ID: <4cf7fc4a$0$14255$ba620e4c_at_news.skynet.be>
John Peterson wrote:
>
> "Gerard H. Pille" <ghp_at_skynet.be> wrote in message news:4ce6b41f$0$14255$ba620e4c_at_news.skynet.be...
>>
>> SELECT XMLROOT ( XMLElement("OuterElement",
>> "<AllMyQueryResultsXML/>"
>> ), VERSION '1.0', STANDALONE YES)
>> AS "XMLROOT" FROM DUAL;
>>
>>
>
> Thanks Gerald -- but I can't seem to figure out how to structure the query inside of the outer
> query. Maxim's reply seems to be (sort of) working for me, so I'll probably go that route.
Pourtant, c'est simple comme bonjour:
XMLROOT
<?xml version="1.0" standalone="yes"?>
<OuterElement>
<Topic>
<TOPICID>1</TOPICID> <TOPICDESC>This is the first topic</TOPICDESC> <AREA>0</AREA>
</Topic>
<Topic>
<TOPICID>2</TOPICID> <TOPICDESC>This is the second topic</TOPICDESC> <AREA>0</AREA>
</Topic>
<Topic>
<TOPICID>3</TOPICID> <TOPICDESC>This is the third topic</TOPICDESC> <AREA>1</AREA>
</Topic>
<Topic>
<TOPICID>4</TOPICID> <TOPICDESC>This is the fourth topic</TOPICDESC> <AREA>1</AREA>
</Topic>
</OuterElement>
SQL> l
1 SELECT XMLROOT (
2 XMLElement(
3 "OuterElement", 4 xmlagg( 5 XMLElement( 6 "Topic", 7 xmlelement("TOPICID",TOPICID), 8 xmlelement("TOPICDESC",TOPICDESC), 9 xmlelement("AREA",AREA) 10 ) 11 ) 12 ), VERSION '1.0', STANDALONE YES)13* AS "XMLROOT" FROM faq.topic Received on Thu Dec 02 2010 - 14:06:38 CST