Database Reference
In-Depth Information
Figure 17.5
XML Element Tags
with Tag
Attributes.
,
XMLELEMENT
("City", A.CITY)
,
("Country", A.COUNTRY)).GETSTRINGVAL()
FROM ARTIST A;
XMLELEMENT
Multiple child tags occurring in more than one parent tag can be aggre-
gated into a single parent tag. In the following script, all artist names are
placed within a single Artist tag, as shown in Figure 17.6.
SELECT XMLELEMENT("Artist"
,
(XMLELEMENT("Name", A.NAME))).GETSTRINGVAL()
FROM ARTIST A;
XMLAGG
The only downside to the XMLAGG function is that only a single col-
umn can be aggregated. Thus the next example will cause an error because
more than one XML tag is created.
SELECT XMLELEMENT( "Artist"
, XMLAGG( XMLELEMENT ("Name", A.NAME)
, XMLELEMENT ("City", A.CITY))).GETSTRINGVAL()
FROM ARTIST A;
 
Search WWH ::




Custom Search