Definition:
The Oracle UPDATEXML function allows you to update XML content stored in Oracle Database. It takes an XMLType instance and an XPath-value pair as arguments and returns an XMLType instance with the updated value.
Example Syntax:
UPDATEXML(XMLType_Instance, XPath_string,
value_expression, namespace_string)
Example Usage:
SELECT warehouse_name,
EXTRACT(warehouse_spec, '/Warehouse/Docks') "Number of Docks"
FROM warehouses
WHERE warehouse_name = 'San Francisco';
UPDATE warehouses
SET warehouse_spec = UPDATEXML(warehouse_spec,
'/Warehouse/Docks/text()',4)
WHERE warehouse_name = 'San Francisco';
SELECT warehouse_name,
EXTRACT(warehouse_spec, '/Warehouse/Docks') "Number of Docks"
FROM warehouses
WHERE warehouse_name = 'San Francisco';
Related Links: