Subodh Joshi
Subodh Joshi

Reputation: 13522

jOOQ: How to call Sql User defined Function Within Select Query

I have to execute Select query with a function call in jOOQ how to do it? I have to write this type of jOOQ Query.

Select Cola,col2,Col3, f_feeAmount(arg) col4 from SomeTable  

How to write jOOQ Code for this?

SelectQuery<Record> selectQueryFee = transRefundFee.selectQuery();
selectQueryFee.addSelect(AccountBillFee.ACCOUNT_BILL_FEE.ACCOUNT_BILL_FEE_RSN,AccountBill.ACCOUNT_BILL.BILL_NUMBER,AccountBill.ACCOUNT_BILL.PAYMENT_OPTION);
selectQueryFee.addSelect(f_feeAmount(arg));

But f_feeAmount is not recognized by jOOQ because its a User defined function.

Upvotes: 1

Views: 1706

Answers (1)

Lukas Eder
Lukas Eder

Reputation: 221210

User-defined functions are generated in a Routines class. You can just static-import all methods from that class:

import static com.example.generated.Routines.*;

And then, writing f_feeAmount(arg) should be fine.

See also this page of the jOOQ manual about generated global artefacts.

Upvotes: 2

Related Questions