代码之家  ›  专栏  ›  技术社区  ›  Subodh Joshi

jOOQ:如何在Select Query中调用Sql用户定义函数

  •  1
  • Subodh Joshi  · 技术社区  · 12 年前

    我必须使用中的函数调用执行Select查询 jOOQ 怎么做?我必须编写这种类型的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));
    

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

    1 回复  |  直到 12 年前
        1
  •  2
  •   Lukas Eder    12 年前

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

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

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

    另请参阅jOOQ手册的此页 generated global artefacts .