简体   繁体   中英

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM