對于以下查詢,我收到錯誤ORA-01867:間隔無效
@Query(value="select * from Customer s where s.CUS_ID=:customerid and s.INSERT_TM < systimestamp - INTERVAL ':threshold' MINUTE", nativeQuery=true)
@List<Customers> getCustomers(@Param("customerid") String customerid, @Param("threshold") Integer threshold )
此陳述句有錯誤
INTERVAL ':threshold' MINUTE
但是如果我對閾值欄位進行硬編碼,那么我會得到成功回應,
INTERVAL '5' MINUTE
我不想硬編碼。有人可以告訴我如何解決這個問題嗎?
uj5u.com熱心網友回復:
您可能想要執行以下技巧以使其作業:
@Query"select * from Customer s where s.CUS_ID=:customerid and s.INSERT_TM < systimestamp - :threshold*INTERVAL '1' MINUTE"
@List<Customers> getCustomers(@Param("customerid") String customerid, @Param("threshold") String threshold )
只是為了證明乘法適用于區間,你可以檢查這個小提琴
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/472547.html
下一篇:oracle觸發例外
