Right
Definition
The right
method allows you to add the RIGHT
function to the query. The RIGHT
function return last n characters in the string. When n is negative, return all but first |n| characters.
Available methods
right(KColumn kColumn, int n)
: Receives aKColumn
orKTableColumn
and an int which will be supplied to theRIGHT
function.right(KValTextField kValTextField, int n)
: Receives aKValTextField
and an int which will be supplied to theRIGHT
function.
To use this way, you need to import the static functions as follows:
import static com.myzlab.k.KFunction.*;
Example: (KColumn, int)
Java code:
k
.select(
right(APP_USER.FIRST_NAME, 2)
)
.from(APP_USER)
.multiple();
SQL generated:
SELECT
RIGHT(au.first_name, 2)
FROM app_user au
Parameters:
- None
Example: (KValTextField, int)
Java code:
k
.select(
right(val("A text"), 2)
)
.single();
SQL generated:
SELECT RIGHT(?1, 2)
Parameters:
- ?1: "A text"