欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

com.alibaba.druid.sql.parser.ParserException: syntax error, error in :‘xx)

程序员文章站 2022-06-22 20:33:43
先来看下 xml错误信息14:57:58.150 [http-nio-7070-exec-26] ERROR c.a.d.f.s.StatFilter - [mergeSql,149] - merge sql error, dbType oracle, druid-1.1.14, sql : SELECT *FROM (select check_code, check_name, chect_qualification_expires_time,CONCAT('Overdue_', remark...

先来看下 xml
com.alibaba.druid.sql.parser.ParserException: syntax error, error in :‘xx)
错误信息

14:57:58.150 [http-nio-7070-exec-26] ERROR c.a.d.f.s.StatFilter - [mergeSql,149] - merge sql error, dbType oracle, druid-1.1.14, sql : SELECT *
		FROM (select check_code, check_name, chect_qualification_expires_time,CONCAT('Overdue_', remark)  explain
			FROM JC_CHECK_INFO
			WHERE chect_qualification_expires_time BETWEEN to_date(to_char(sysdate, 'yyyy-mm-dd'),'yyyy-mm-dd') AND to_date(to_char(sysdate+30, 'yyyy-mm-dd'),'yyyy-mm-dd')
			ORDER BY chect_qualification_expires_time )a
		UNION ALL
		
		SELECT *
		FROM (select check_code, check_name, chect_qualification_expires_time,CONCAT('Expired_', remark)  explain
			FROM JC_CHECK_INFO
			WHERE to_date(to_char(sysdate, 'yyyy-mm-dd'),'yyyy-mm-dd') > chect_qualification_expires_time
			ORDER BY chect_qualification_expires_time desc)b
com.alibaba.druid.sql.parser.ParserException: syntax error, error in :'rk)  explain
			FROM JC_CHECK_INFO
', expect RPAREN, actual EXPLAIN pos 116, line 2, column 100, token EXPLAIN
	at com.alibaba.druid.sql.parser.SQLParser.printError(SQLParser.java:287)
	at com.alibaba.druid.sql.parser.SQLParser.accept(SQLParser.java:295)
	at com.alibaba.druid.sql.dialect.oracle.parser.OracleSelectParser.parseTableSourcePrimary(OracleSelectParser.java:651)
	at com.alibaba.druid.sql.dialect.oracle.parser.OracleSelectParser.parseTableSource(OracleSelectParser.java:624)

先声明下sql是没有问题的,运行正常,在xml就会报以上错误信息,但是程序不受影响

sql运行正常,我也一直没找到原因,网上有的说是版本低的原因,解析不了,我…还就不信了,不换版本不行?

后来抱着试一试的心态,结果成功了。原因就是…不要偷懒!!!
取别名时乖乖加上 as 就没问题了

com.alibaba.druid.sql.parser.ParserException: syntax error, error in :‘xx)

本文地址:https://blog.csdn.net/weixin_42599079/article/details/107665166