jOOQ:如何在Select Query中调用Sql User defined Function

时间:2013-10-28 10:35:35

标签: java sql jooq

我必须在jOOQ中使用函数调用执行Select查询怎么做?我必须编写这种类型的jOOQ查询。

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

如何为此编写jOOQ代码?

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));

但是jOOQ无法识别f_feeAmount,因为它是用户定义的函数。

1 个答案:

答案 0 :(得分:2)

用户定义的函数在Routines类中生成。您可以静态导入该类中的所有方法:

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

然后,写f_feeAmount(arg)应该没问题。

另请参阅关于generated global artefacts的jOOQ手册的此页面。