我写了一个查询,它获取员工的数量,我在 sql 开发人员中对其进行了测试,它准确且工作正常,但不知何故我在我的 IDE 日志中收到 BadSqlGrammeException
SELECT COUNT(DISTINCT emp_code)
FROM Xxmpcd_Salary_Detail_Table
WHERE Prayas_Erp_Org_Id LIKE '202-%'
AND Yyyymm='201803'
ORDER BY Emp_Name ASC;
IDE日志
org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [SELECT count(Distinct emp_code) FROM Xxmpcd_Salary_Detail_Table WHERE Prayas_Erp_Org_Id LIKE '202-%' AND Yyyymm='201803' Order by Emp_Name ASC;]; nested exception is java.sql.SQLException: ORA-00911: invalid character
at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:99)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:645)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:680)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:707)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:757)
at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.queryForObject(NamedParameterJdbcTemplate.java:211)
米脂
相关分类