I have a table in Oracle which contains the column DATUM
of type Date
.
After running "jooq-codegen:generate", a Java class was created where the field DATUM
got the type LocalDate
.
Now I would like to have a difference between 01.01.2022
and DATUM
in JOOQ.
In Oracle, it would simply be
TO_DATE('01.01.2022') - DATUM
However I can't manage to translate that into JOOQ.
With minus
it does not accept the data type. The dateDiff
function does not work neither because DATUM in Java became LocalDate
and it has to be Date
. How can I transform the type within the JOOQ-Statement? Or any other solutions?
All the functions your are looking for are on the DSL
class
DSL.localDateDiff(DSL.localDate("01.01.2022"), TABLE.DATUM);
Please checkout the API Doc: https://www.jooq.org/javadoc/latest/org.jooq/org/jooq/impl/DSL.html