ORA-00933: SQL 命令在 SQL 开发人员中正常运行的查询中未正确结束

ORA-00933: SQL command not properly ended in a query that runs fine in SQL developer

下面的代码给出了

ORA-00933: SQL command not properly ended

    private final String DUPLICATE_SQL_1="select abc, count(abc)"
            +"from table_1"
            +"where type= 'NEW'"
            +"and trunc(update_date) = trunc(sysdate)"
            +"group by abc having count(abc)>1";

ResultSet rs = stmt.executeQuery(DUPLICATE_SQL_1);

相同的查询在 Oracle SQL 开发人员上运行良好。

您缺少 spaces(除最后一行之外的每一行的末尾或除第一行之外的每一行的开头必须有一个 space):

private final String DUPLICATE_SQL_1="select abc, count(abc) "
        +"from table_1 "
        +"where type= 'NEW' "
        +"and trunc(update_date) = trunc(sysdate) "
        +"group by abc having count(abc)>1";