Definition:
The Oracle EXTRACTVALUE function is an XML Type function which is used to select leaf node data value. Note that only lower or sublevel node values can be extracted. It returns value in VARCHAR2 format.
Example Usage:
The SQL query below returns the value existing on XPath '/Orders/MailAddressTo/Company'.
SELECT EXTRACTVALUE(OBJECT_VALUE, '/Orders/MailAddressTo/Company')
AS Company
FROM ORDERS_XML;
COMPANY
--------------
Google
The SQL query below returns the value existing on XPath /Orders/MailAddressTo. But note that the query fails because the XPath contains subcode.
SELECT EXTRACT_VALUE(OBJECT_VALUE, '/Invoice/MailAddressTo') AS MailAddressTo
FROM ORDERS_XML;
from orders_xml
*
ERROR at line 2:
ORA-19025: EXTRACTVALUE returns value of only one node
Related Links: