AGE in JOOQ

17 views
Skip to first unread message

Konstantin Kuzmin

unread,
Jan 17, 2024, 10:30:34 AM1/17/24
to jOOQ User Group
Hello! How to convert this sql to jooq? Thx
select extract(year from AGE(now(), to_timestamp(cti_birthdate_id::text, 'YYYYMMDD'))) from citizen_identity;

Lukas Eder

unread,
Jan 17, 2024, 10:31:49 AM1/17/24
to jooq...@googlegroups.com
Thanks for your message. 

jOOQ doesn't have native support for this function. But you can always add support for vendor specific functionality using a plain SQL template:

I hope this helps,
Lukas

On Wed, Jan 17, 2024 at 4:30 PM Konstantin Kuzmin <java...@gmail.com> wrote:
Hello! How to convert this sql to jooq? Thx
select extract(year from AGE(now(), to_timestamp(cti_birthdate_id::text, 'YYYYMMDD'))) from citizen_identity;

--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/a4f8ba9d-4983-4c02-a000-241de8f70296n%40googlegroups.com.

Rob Sargent

unread,
Jan 17, 2024, 10:34:20 AM1/17/24
to jooq...@googlegroups.com


On Jan 17, 2024, at 8:30 AM, Konstantin Kuzmin <java...@gmail.com> wrote:

Hello! How to convert this sql to jooq? Thx
select extract(year from AGE(now(), to_timestamp(cti_birthdate_id::text, 'YYYYMMDD'))) from citizen_identity;

--

What have you tried?


Konstantin Kuzmin

unread,
Jan 17, 2024, 2:07:37 PM1/17/24
to jOOQ User Group
I found out how the AGE function works approximately.

select (20240101 - 20200102) / 10000;
3 full years.

среда, 17 января 2024 г. в 18:34:20 UTC+3, robjs...@gmail.com:
Reply all
Reply to author
Forward
0 new messages