Database Reference
In-Depth Information
EXISTSNODE (XMLType object, search path, expression) .
Searches for the expression in a path (search path) within an XML
document XMLType object. This function will return 1 if a node
exists.
EXTRACT (XMLType object, search path, expression) . As already
seen, the EXISTSNODE function verifies the presence of a string.
The EXTRACT function returns the tag and its contents.
EXTRACTVALUE (XMLType object, search path, expression) .
This function finds the same strings or patterns as the EXTRACT
function except it returns scalar values, as opposed to tags. Therefore,
where the EXTRACT function returns <City>Los Angeles</City>,
the EXTRACTVALUE function returns the value between the City
tags, namely Los Angeles.
Now let's demonstrate by example. The first example finds the CD iden-
tifier
where
that
CD
has
at
least
one
Length
value
(SONG.PLAYING_TIME) in its structure:
SELECT ID FROM XML WHERE EXISTSNODE(XML
, 'Artist/CD/Song/Length') = 1;
This query will verify the previous query by looking at the data in the
tables. Figure 17.14 shows both of these queries put together.
Figure 17.14
Demonstrating /, //,
and
EXISTSNODE.
Search WWH ::




Custom Search