Available in versions: Dev (3.20) | Latest (3.19) | 3.18

This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.

ARRAY_CONCAT (|| operator)

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

The ARRAY_CONCAT (or ARRAY_CAT) function allows for concatenating arrays (see also ARRAY_APPEND and ARRAY_PREPEND for API to concatenate single values with arrays):

SELECT ARRAY[1, 2] || ARRAY[3, 4]
create.select(arrayConcat(array(1, 2), array(3, 4))).fetch();

The result would look like this:

+--------------+
| array_concat |
+--------------+
| [1, 2, 3, 4] |
+--------------+
See CONCAT for a text version of this function.

Dialect support

This example using jOOQ:

arrayConcat(array(1, 2), array(3, 4))

Translates to the following dialect specific expressions:

Aurora Postgres, BigQuery, CockroachDB, DuckDB, H2, HSQLDB, Postgres, Trino, YugabyteDB

(ARRAY[1, 2] || ARRAY[3, 4])

ClickHouse

arrayConcat(
  ARRAY(1, 2),
  ARRAY(3, 4)
)

ASE, Access, Aurora MySQL, DB2, Derby, Exasol, Firebird, Hana, Informix, MariaDB, MemSQL, MySQL, Oracle, Redshift, SQLDataWarehouse, SQLServer, SQLite, Snowflake, Sybase, Teradata, Vertica

/* 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