> This is the JOOQ-ization of the following query: Nice to see so much jOOQ in action.
The Oracle temporal TRUNC function (probably similar to the Postgres DATE_TRUNC function) should be implemented in jOOQ some time soon: https://github.com/jOOQ/jOOQ/issues/470 Date-time arithmetic is difficult to implement coherently across all databases. So far I haven't had any time to look into this any closer. > Lukas would be more specific about best practice, but this is how we solved > the problem: > > Field<Date> truncDay = Factory.field("trunc({0}, {1})", SQLDataType.DATE, > YOUR_FIELD_GOES_HERE, inline("DD")); I agree that such an approach is your best choice right now, before things actually get implemented in jOOQ. Beware that you may have to provide some additional abstraction, if you want to support the same semantics in several SQL dialects. Cheers Lukas
