PostgreSQL concat_ws() Function
The PostgreSQL concat_ws() function concatenates the arguments as a string using a delimiter and return the result.
concat_ws() Syntax
This is the syntax of the PostgreSQL concat_ws() function:
concat_ws(separator, param1[, param2] ...)
Parameters
separator-
Required. delimiter.
param1-
Required. A value of any data type.
param2...-
Optional. A value of any data type.
Return value
The PostgreSQL concat_ws() function concatenates the arguments as a string using a delimiter and return the result. The NULL parameter will be skipped.
concat_ws() Examples
This example shows how to concatenate multiple arguments into a string by using the concat_ws() function.
SELECT concat_ws(' ', 'Hello', 'World') AS "concat_ws(' ', 'Hello', 'World')";
concat_ws(' ', 'Hello', 'World')
----------------------------------
Hello WorldYou can use the concat_ws() function to generate a comma-separated set:
SELECT concat_ws(',', 'a', 'b', 'c') AS "concat_ws(',', 'a', 'b', 'c')";
concat_ws(',', 'a', 'b', 'c')
-------------------------------
a,b,c