gpt4 book ai didi

java.sql.SQLException : ORA-00934: group function is not allowed here oracle

转载 作者:太空宇宙 更新时间:2023-11-04 13:03:23 26 4
gpt4 key购买 nike

在java代码中给我这个异常

java.sql.SQLException: ORA-00934: group function is not allowed here

当尝试这个查询时,虽然 当我在 sql 引擎中运行此查询时,运行良好,没有任何异常

SELECT MAX(insert_date)
FROM SDP_SYNCH_REQUEST
HAVING ((sysdate - MAX(insert_date)) * 24 * 60) > 5

不知道为什么

最佳答案

请在SELECT验证并适本地处理情况。

SELECT 
CASE WHEN ((SYSDATE - MAX(insert_date)) * 24 * 60) > 5
THEN
MAX(insert_date)
ELSE
NULL
END as insert_date
FROM SDP_SYNCH_REQUEST

或者仅当您考虑它是否返回一行时。

SELECT insert_date
FROM
(
SELECT MAX(insert_date) AS insert_date
FROM SDP_SYNCH_REQUEST
) WHERE ((SYSDATE - insert_date) * 24 * 60) > 5

关于java.sql.SQLException : ORA-00934: group function is not allowed here oracle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34720647/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com