Database Reference
In-Depth Information
Figure 17.11
Duplicating Parent
Tags.
later in this chapter. For now all I have done is copy the first two rows in
Figure 17.10 and pasted and annotated them into Figure 17.11.
Most relational database interpretation of XML is direct and dumps
rows into two dimensions, as results would appear in row form, such as in
this join.
Note: Two-dimensional data is useful for platform-independent transfer
between multiple databases. However, there are other, faster methods for
achieving this task with Oracle Database.
The beauty of XML is its potential object hierarchical nature, effectively
allowing removal of duplicated data. Figure 17.11 clearly shows that dupli-
cation is present in abundance. What can we do about this? We can use a
function called XMLAGG to aggregate data. In its simplest form,
XMLAGG is limited, because it appears to be capable of descending only
into a single level of a hierarchy. XMLCONCAT does not help either in
this respect because of conflict between the aggregation functions and the
GROUP BY clause. The result of the following query as shown in Figure
17.12 is much better than that of Figure 17.11, but it is still not correct, as
can be seen by appropriate annotations in Figure 17.12, because artists
remain duplicated.
SELECT XMLELEMENT("Artist", XMLATTRIBUTES(A.NAME "Name")
Search WWH ::




Custom Search