Available in versions: Dev (3.20) | Latest (3.19) | 3.18 | 3.17 | 3.16 | 3.15 | 3.14

DOCUMENT predicate

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

The DOCUMENT predicate can be used to check if a given expression is an XML document (as opposed to toher XML content).

SELECT 1
WHERE
  '<xml/>' IS DOCUMENT
  AND '<!-- comment -->' IS NOT DOCUMENT
create.selectOne()
      .where(val("<xml/>").isDocument())
      .and(val("<!-- comment -->").isNotDocument())
      .fetch();

Dialect support

This example using jOOQ:

AUTHOR.FIRST_NAME.isDocument()

Translates to the following dialect specific expressions:

Postgres

AUTHOR.FIRST_NAME IS DOCUMENT

ASE, Access, Aurora MySQL, Aurora Postgres, BigQuery, ClickHouse, CockroachDB, DB2, Derby, DuckDB, Exasol, Firebird, H2, HSQLDB, Hana, Informix, MariaDB, MemSQL, MySQL, Oracle, Redshift, SQLDataWarehouse, SQLServer, SQLite, Snowflake, Sybase, Teradata, Trino, Vertica, YugabyteDB

/* UNSUPPORTED */
Generated with jOOQ 3.20. Translate your own SQL on our website

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo