Fetch
Definition
The fetch
method allows you to add the FETCH
clause to the query.
Available methods
1. fetch(int count)
- count: an int value which will be added to
FETCH
clause.
2. fetch(long count)
- count: a long value which will be added to
FETCH
clause.
3. fetch(
KOptionalLong
kOptionalLong)
- kOptionalLong: a long value which will be added to
FETCH
clause.
Method hierarchy
The fetch
method can be used right after the following methods:
selectDistinct
,select1
,select
,from
,innerJoin
,leftJoin
,rightJoin
,fullJoin
,crossJoin
,where
,and
,andNot
,or
,orNot
,groupBy
,having
,and
,andNot
,or
,orNot
,window
,except
,exceptAll
,intersect
,intersectAll
,union
,unionAll
,orderBy
,offset
and the subsequent methods that can be called are:
Example: int
Java code:
k
.select(
APP_USER.FIRST_NAME
)
.from(APP_USER)
.fetch(10)
.multiple();
SQL generated:
SELECT au.first_name
FROM app_user au
FETCH FIRST 10 ROWS ONLY
Parameters:
- None
Example: KOptionalLong
(null value)
Java code:
final Long nullLong = null;
k
.select(
APP_USER.FIRST_NAME
)
.from(APP_USER)
.fetch(optional(nullLong))
.multiple();
SQL generated:
SELECT au.first_name
FROM app_user au
Parameters:
- None
Example: KOptionalLong
(not null value)
Java code:
final Long nullLong = 10;
k
.select(
APP_USER.FIRST_NAME
)
.from(APP_USER)
.fetch(optional(nullLong))
.multiple();
SQL generated:
SELECT au.first_name
FROM app_user au
FETCH FIRST 10 ROWS ONLY
Parameters:
- None