Skip to main content

Initcap

Definition

The initcap method allows you to add the INITCAP function to the query. The INITCAP function is used to convert the first letter of each word to upper case and the remaining to lower case.

There are 2 ways to call this method:

1. Calling from a KColumn or a KTableColumn

The only one method available to use this functionality calling from a KColumn or a KTableColumn is:

  • initcap(): It does not receive any parameters. The KColumn or KTableColumn that invokes the method will be the one supplied to the INITCAP function.

Example

Java code:

k
.select(
APP_USER.EMAIL.initcap()
)
.from(APP_USER)
.multiple();

SQL generated:

SELECT
INITCAP(au.email)
FROM app_user au

Parameters:

  • None

2. Calling from the KFunction class

The only one method available to use this functionality calling from the KFunction class is:

  • initcap(KColumn kColumn): Receives a KColumn or a KTableColumn which will be supplied to the INITCAP 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(
initcap(APP_USER.EMAIL)
)
.from(APP_USER)
.multiple();

SQL generated:

SELECT
INITCAP(au.email)
FROM app_user au

Parameters:

  • None