I want to use REGEXP_REPLACE
sql function (I’m targeting Postgres), but after quick inspection of DSL
class in JOOQ it seems that it is not exposed yet.
How should I approach the problem of adding new function?
- I can try extending
AbstractFunction
, similarly toorg.jooq.impl.Replace
- Is there any more general way to calling functions not exposed by JOOQ’s DSL?
Advertisement
Answer
public static Field<String> regexpReplace( Field<String> in, String pattern, String replacement ) { return DSL.field( "regexp_replace({0}, {1}, {2})", in.getDataType(), in, DSL.val(pattern), DSL.val(replacement) ); }