Available in versions: Dev (3.21)
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.
CONCAT_WS
Supported by ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
The CONCAT_WS() function (where WS = "with separator") concatenates several strings and interleaves a separator:
SELECT concat_ws(',', 'a', 'b', 'c');
create.select(concat(",", "a", "b", "c")).fetch();
The result being
+-----------+ | concat_ws | +-----------+ | a,b,c | +-----------+
Dialect support
This example using jOOQ:
concatWs(",", "a", "b")
Translates to the following dialect specific expressions:
Aurora MySQL, Aurora Postgres, ClickHouse, CockroachDB, Databricks, DuckDB, Exasol, H2, HSQLDB, MariaDB, MemSQL, MySQL, Postgres, SQLDataWarehouse, SQLServer, SQLite, Snowflake, Spanner, Trino, YugabyteDB
concat_ws(',', 'a', 'b')
BigQuery, Redshift
CASE
WHEN ',' IS NOT NULL THEN ltrim(
(CASE
WHEN 'a' IS NULL THEN ''
ELSE (',' || 'a')
END || CASE
WHEN 'b' IS NULL THEN ''
ELSE (',' || 'b')
END),
','
)
END
DB2, Firebird, Hana, Informix, Teradata, Vertica
CASE
WHEN ',' IS NOT NULL THEN trim(LEADING ',' FROM (CASE
WHEN 'a' IS NULL THEN ''
ELSE (',' || 'a')
END || CASE
WHEN 'b' IS NULL THEN ''
ELSE (',' || 'b')
END))
END
Oracle
CASE
WHEN ',' IS NULL THEN (CASE
WHEN 'a' IS NULL THEN ''
ELSE (',' || 'a')
END || CASE
WHEN 'b' IS NULL THEN ''
ELSE (',' || 'b')
END)
ELSE trim(LEADING ',' FROM (CASE
WHEN 'a' IS NULL THEN ''
ELSE (',' || 'a')
END || CASE
WHEN 'b' IS NULL THEN ''
ELSE (',' || 'b')
END))
END
ASE, Access, Sybase
/* UNSUPPORTED */
Generated with jOOQ 3.21. Support in older jOOQ versions may differ. Translate your own SQL on our website
Feedback
Do you have any feedback about this page? We'd love to hear it!