The Legacy Obituaries

DBMS_XMLQUERY / DBMS_XMLSAVE

pre-11.2 · plsql · deprecated 18c · desupported 21c

Survived, partially.

✓ certified by the mortician

In life

DBMS_XMLQUERY turns the result of a SQL query into an XML document, and DBMS_XMLSAVE performs inserts, updates and deletes from XML input. Both are Java-based members of the original XML SQL Utility and were kept for compatibility long after kernel-native alternatives appeared.

Migrations care because these calls usually sit inside integration code that produces or consumes XML for other systems. On Azure SQL the equivalent is FOR XML and the xml type methods; on PostgreSQL it is the SQL/XML functions. The Oracle-side replacements, DBMS_XMLGEN and DBMS_XMLSTORE, are close enough that converting to them first can simplify a later port.

Oracle's 18c Upgrade Guide deprecates both packages and recommends DBMS_XMLGEN and DBMS_XMLSTORE, which are written in C and faster. The 21c Upgrade Guide lists both as desupported. The roster hint of an 18c desupport does not match Oracle's pages, which give 18c as the deprecation release and 21c as the desupport release.

Cause of departure

Desupported in Oracle Database 21c after deprecation in 18c. Oracle names DBMS_XMLGEN and DBMS_XMLSTORE as the successor.

Obituary

DBMS_XMLQUERY / DBMS_XMLSAVE, born before 11.2, served PL/SQL by turning query results into XML documents. It also inserted, updated, and deleted rows from XML, a practical two-way trade.

Deprecated in 18c, it was desupported in 21c, with DBMS_XMLGEN and DBMS_XMLSTORE named as Oracle replacements. Its departure was orderly, if not especially XML-shaped.

It is survived by Azure Database for PostgreSQL Flexible Server, where it lives on partly through SQL/XML functions, and Azure SQL Database, where it lives on partly through FOR XML and XML shredding. Naming conventions differ, so consumers usually need adjustment.

Survived by

Azure Database for PostgreSQL Flexible Server partial effort M

Applies to Oracle 11.2, 12.1, 12.2

PostgreSQL's SQL/XML functions generate documents from queries (query_to_xml, table_to_xml, cursor_to_xml, xmlelement, xmlforest, xmlagg) and shred them with XMLTABLE, xpath and xpath_exists, matching the two halves of DBMS_XMLQUERY and DBMS_XMLSAVE. Only XPath 1.0 is supported, the default row and column element naming follows the SQL/XML standard rather than Oracle's ROWSET/ROW layout, and the server must be built with libxml (Flexible Server is).

  • Replace DBMS_XMLQUERY.getXML with query_to_xml or explicit xmlelement/xmlagg construction to match the expected shape.
  • Replace DBMS_XMLSAVE with INSERT ... SELECT FROM XMLTABLE(...).
  • Validate namespaces and XPath expressions against the 1.0 subset.

Complications

minor PostgreSQL's xpath, xpath_exists and XMLTABLE support only XPath 1.0 expressions, the XML functions require a server built with libxml, and generated documents follow the SQL/XML standard element names rather than Oracle's ROWSET/ROW layout.

Azure SQL Database partial effort M

Applies to Oracle 11.2, 12.1, 12.2

DBMS_XMLQUERY turned query results into XML documents and DBMS_XMLSAVE inserted, updated and deleted rows from XML. T-SQL covers both directions: FOR XML (RAW, AUTO, EXPLICIT and PATH modes, with TYPE returning an xml value) generates documents from queries, and OPENXML with sp_xml_preparedocument or the xml type's nodes() and value() methods shred documents into rowsets for DML. Element and attribute naming conventions differ, so consumers of the generated XML usually need adjustment.

  • Replace DBMS_XMLQUERY.getXML calls with SELECT ... FOR XML PATH (or RAW/AUTO) with ROOT and ELEMENTS as needed.
  • Replace DBMS_XMLSAVE insert/update/delete calls with INSERT ... SELECT from OPENXML or nodes()/value().
  • Compare generated documents against the Oracle output for tag names and NULL handling.

Complications

minor OPENXML operates on a document handle produced by sp_xml_preparedocument that must be released with sp_xml_removedocument, and returns an edge-table representation when no WITH clause is supplied.

Notices of correction

  1. oracle Deprecated Features in Oracle Database 18c · Upgrade Guide 18c, E88788-13, Dec 2021 · read 2026-09-26
  2. oracle Oracle Database Changes, Desupports, and Deprecations (Upgrade Guide 21c) · Upgrade Guide 21c, F17069-48, Feb 2026 · read 2026-09-26
  3. oracle Introduction to Oracle XML DB (XML DB Developer's Guide 19c) · Oracle XML DB Developer's Guide 19c · read 2026-09-26
  4. community PostgreSQL documentation: XML functions · PostgreSQL 18 · read 2026-09-26
  5. microsoft FOR XML (SQL Server) · page updated 2026-06-23 · read 2026-09-26
  6. microsoft OPENXML (Transact-SQL) · page updated 2026-08-24 · read 2026-09-26

← All notices

DBMS_XMLQUERY / DBMS_XMLSAVE — Legacy Obituaries