Utilising the EXTRACTVALUE function with XPath expressions
Oracle HCM records many transactional events, including employee changes, in XML format stored within the column XML_DATA_CACHE of the table HRC_TXN_HEADER. This XML contains detailed change data but requires parsing to extract meaningful information for reporting.
Why Use EXTRACTVALUE?
The EXTRACTVALUE() SQL function allows you to extract specific values from XML stored as CLOB or XMLType in the database. This is essential when dealing with the XML_DATA_CACHE column because the data is nested and structured—standard SQL queries alone can’t read it.
How to Extract Key Change Data
Here’s a typical use case: pulling out the old and new values for changed attributes on a transaction record.
Sample SQL:
SELECT transaction_id,
EXTRACTVALUE(XMLTYPE(xml_data_cache), '//*/*[local-name()="Assignment"]/OldValue') AS OldAssignment,
EXTRACTVALUE(XMLTYPE(xml_data_cache), '//*/*[local-name()="Assignment"]/NewValue') AS NewAssignment,
transaction_date
FROM hrc_txn_header
WHERE transaction_date >= TO_DATE('2025-01-04', 'YYYY-MM-DD');
This example extracts old and new assignment values from within the XML structure for each transaction, filtering only recent changes.
Important Tips
Use
XMLTYPE()to handle the XML CLOB column correctly.XPath expressions with
local-name()handle element names flexibly, which is useful when namespaces or prefixes vary.The XML structure can be complex; explore the XML using tools or queries like
XMLTABLE()for more sophisticated extraction.Be aware of Oracle XML function limitations and ensure single-node returns with
EXTRACTVALUE().
Why This Matters
Extracting detail from the XML transaction cache enables detailed audits, historical reporting, and analytics on employee changes within Oracle HCM without needing export tools or external parsing. It’s a powerful method for BI developers and analysts looking to unlock rich transactional insights directly from the database.
Summary
Using EXTRACTVALUE() on HRC_TXN_HEADER.XML_DATA_CACHE bridges the gap between rich XML-stored transactional data and conventional relational reporting, enabling sophisticated HR analytics in Oracle Fusion Cloud HCM.
Need some assistance?
Ready to bring clarity to customer, supplier and employee communications? With BI Publisher, we specialise in customising customer, supplier, and employee-facing documents such as invoices, purchase orders, payslips, and statements to meet your exact branding, compliance, and operational needs. From layout design to data logic enhancements, we help you deliver clear, consistent, and impactful outputs across your organization. Contact us today to discover how our expertise in BI Publisher can streamline your document processes and elevate your business communications.

