在程序运行时,程序报sql错误“nested exception is java.sql.SQLException: ORA-00933: SQL 命令未正确结束”,具体错误如下所示:
调用函数异常...org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [select a.*, c.sitename siteName, e.empname okusername, f.empname checkusername, h.sitename getsitename, g.empname enterusername from tmt_matoutmaster a left join ts_siteinfo c on a.siteid = c.siteid left join tbempinfo e on a.okuser = e.empid left join tbempinfo f on a.checkuser = f.empid left join tbempinfo g on a.enteruser = g.empid left join ts_siteinfo h on a.getsite = h.siteid where 1 = 1 and a.gettime between to? and ? and a.okStatus = ? and a.siteid = ? and a.centerid = ? and a.outno in (?) and a.getsite = ?)]; nested exception is java.sql.SQLException: ORA-00933: SQL 命令未正确结束
“java.sql.SQLException: ORA-00933: SQL 命令未正确结束”错误解决方案
当我们的程序报出如上ORA-00933错误的时候,一般是我们的sql语句错误了,要么多了一些结束符号,要么少了一些符号,上面的示例中,不看【】部分,“and a.getsite = ?)”sql结尾处多了个“)”符号,去掉该符号即可。