11

I have a query like this:

Result<?> result = create.select(CONSUMER.CONS_ID_NO,
                                             CONSUMER.CONS_NAME,
                                             concat(CONSUMER.AREA_CODE, "/", CONSUMER.CONS_NO, "/", CONSUMER.CAT_CODE).as("ConsNo"),
                                             CONSUMER.ARREARS)
                                            .from(CONSUMER)
                                            .fetch();

I wrote this according to the JOOQ Manual, but I am getting an error that says:

The method concat(String...) in the type Factory is not applicable for the arguments (TableField, String, TableField, String, TableField)

I am using JOOQ-3.

1
  • I'm not familiar enough with JOOQ to put this out as an answer, but wonder if you want to use TableField's .getName() method, to get a string instead of a TableField for CONSUMER.AREA_CODE etc.
    – DarenW
    Mar 13, 2013 at 3:34

1 Answer 1

17

It seems that the sample in the manual doesn't work. However, you can convert a string to Filed via org.jooq.impl.Factory.val.

    Record result = create.select(
            concat(AUTHOR.FIRST_NAME, val(" "), AUTHOR.LAST_NAME).as("Full Name")
    ).from(AUTHOR).fetchAny();

Please refer to this email from Lukas Eder for details

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.