Skip to main content

Convert From

Definition

The convertFrom method allows you to add the CONVERT_FROM function to the query. The CONVERT_FROM function convert a string to the current database encoding.

Available methods

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

SQL generated:

SELECT
CONVERT_FROM(CAST(au.first_name AS BYTEA), 'UTF8')
FROM app_user au

Parameters:

  • None