如何在JOOQ中使用toChar函数? [英] How to use toChar function in JOOQ?
问题描述
我必须在 JOOQ
中使用 toChar()
函数?现在我使用下面的代码
I have to use toChar()
function in JOOQ
? Right now i have used below code
TO_CHAR(PaymentDate, 'YYYY-MM-DD') <= TO_CHAR(SYSDATE,'YYYY-MM-DD')");
我必须转换为 JOOQ
。如何在 JOOQ
中使用它?
Which i have to convert into JOOQ
. How to use this in JOOQ
?
推荐答案
jOOQ 3.2没有明确支持Oracle的 TO_CHAR()
函数。我为此添加了一个功能请求:#2832 。为jOOQ 3.3添加明确的支持是有意义的。
Oracle's TO_CHAR()
function is not explicitly supported by jOOQ 3.2. I have added a feature request for this: #2832. It makes sense to add explicit support to jOOQ 3.3.
与此同时,您将不得不求助于纯SQL 如手册中所述。例如,您可以写:
In the mean time, you will have to resort to plain SQL as documented in the manual. For instance, you could write:
// Create reusable fields:
Field<String> f = DSL.field(
"TO_CHAR({0}, 'YYYY-MM-DD')", String.class, T.PaymentDate);
// Create reusable conditions:
Condition c = DSL.condition(
"TO_CHAR({0}, 'YYYY-MM-DD') <= TO_CHAR(SYSDATE, 'YYYY-MM-DD')",
T.PaymentDate);
请注意 {0}
是参考到 QueryPart 参数28java.lang.String,%20org.jooq.QueryPart ...%29rel =nofollow> DSL.condition(String,QueryPart ...)
例如,a>。
Note that {0}
is a reference to the first QueryPart
argument of DSL.condition(String, QueryPart...)
, for instance.
这篇关于如何在JOOQ中使用toChar函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!