New versions: Dev (3.14)

XMLDOCUMENT

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

The XMLDOCUMENT() function is used to produce an XML document from document contents, useful in dialects where this is required in some cases.

SELECT xmldocument(xmlelement(NAME e1))
FROM sysibm.dual
create.select(xmldocument(xmlelement("e1")))
      .fetch();

The result would look like this:

+--------------+
| xmldocument  |
+--------------+
| <e1/>        | 
+--------------+

Dialect support

This example using jOOQ:

xmldocument(xmlelement("e1"))

Translates to the following dialect specific expressions:

-- DB2
xmldocument(xmlelement(NAME e1))

-- ACCESS, ASE, AURORA_MYSQL, AURORA_POSTGRES, COCKROACHDB, CUBRID, DERBY, FIREBIRD, H2, HANA, HSQLDB, INFORMIX, INGRES, 
-- MARIADB, MEMSQL, MYSQL, ORACLE, POSTGRES, REDSHIFT, SQLDATAWAREHOUSE, SQLITE, SQLSERVER, SYBASE, TERADATA, VERTICA
/* UNSUPPORTED */

(These are currently generated with jOOQ 3.14, see #10141)

The jOOQ Logo