Like EXISTSNODE, it returns the set of nodes if they exist.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
Syntax
EXTRACT(XMLType_instance, XPath_string [, namespace_string ])
Parameters
| Parameter | Description |
|---|---|
| XML_Type_instance | The input XMLTYPE variable. |
| XPath_string | The XPATH path string. |
| namespace_string | The default prefix mapping or namespace mapping (optional). |
Examples
The following example creates XML data by assigning an XML string to the c2 variable, extracts nodes that satisfy the XPath expression 'a/b' from c2 using the EXTRACT method, assigns the extracted result to the t1 variable, and then uses the getstringval() method to obtain the string representation of the XML data in t1.
DECLARE
t1 xmltype;
c2 xmltype;
BEGIN
c2 := xmltype('<a><b>aaa</b><b>bbb</b></a>');
t1 := c2.extract('a/b');
dbms_output.put_line(t1.getstringval());
end;
/
