Skip to main content

Convert To

Definition

The convertTo method allows you to add the CONVERT_TO function to the query. The CONVERT_TO function convert a string to the encoding specified.

Available methods

  • convertTo(KColumn kColumn, KEncoding destEncoding): Receives a KColumn or KTableColumn and a KEncoding which will be supplied to the CONVERT_TO 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(
convertTo(APP_USER.FIRST_NAME, utf8())
)
.from(APP_USER)
.multiple();

SQL generated:

SELECT
CONVERT_TO(au.first_name, 'UTF8')
FROM app_user au

Parameters:

  • None