Decode
Definition
The decode
method allows you to add the DECODE
function to the query. The DECODE
function decode binary data from textual representation in string.
Available methods
decode(KColumn kColumn, KFormat kFormat)
: Receives aKColumn
orKTableColumn
and aKFormat
which will be supplied to theDECODE
function.decode(KValTextField kValTextField, KFormat kFormat)
: Receives aKValTextField
and aKFormat
which will be supplied to theDECODE
function.
To use this way, you need to import the static functions as follows:
import static com.myzlab.k.KFunction.*;
Example: (KColumn, KFormat)
Java code:
k
.select(
decode(APP_USER.FIRST_NAME, escape())
)
.from(APP_USER)
.multiple();
SQL generated:
SELECT
DECODE(au.first_name, 'ESCAPE')
FROM app_user au
Parameters:
- None
Example: (KValTextField, KFormat)
Java code:
k
.select(
decode(val("MTIzAAE="), base64())
)
.single();
SQL generated:
SELECT DECODE(?1, 'BASE64')
Parameters:
- ?1: "MTIzAAE="