Skip to main content

Concat Ws

Definition

The concatWs method allows you to add the CONCAT_WS function to the query. The CONCAT_WS function concatenate the arguments as a string using a delimiter and return the result.

Available methods

  • concatWs(String separator, KBaseColumnCastable... kBaseColumnCastables): Receives a String and a variable quantity of KTableColumn, KColumn or Values which will be supplied to the CONCAT_WS function.

To use this way, you need to import the static functions as follows:

import static com.myzlab.k.KFunction.*;

Example

Java code:

k
.select(
concatWs(",", APP_USER.FIRST_NAME, val(" "), APP_USER.LAST_NAME)
)
.from(APP_USER)
.multiple();

SQL generated:

SELECT
CONCAT_WS(?1, au.first_name, ?2, au.last_name)
FROM app_user au

Parameters:

  • ?1: ","
  • ?2: " "