最近在做一个项目,需要对ocr扫描时间进行排序,当一阵操作猛如虎过后,开始进行测试,控制台刷刷刷报错,报错信息如下:
Caused by:
net.sf.jsqlparser.parser.ParseException: Encountered " <S_CHAR_LITERAL> "\'send.acceptId\' "" at line 2, column 24.
Was expecting one of:
"DO" ...
"ANY" ...
"KEY" ...
"PERCENT" ...
"END" ...
"OPEN" ...
"TABLE" ...
"XML" ...
"VALUE" ...
"INSERT" ...
"VALUES" ...
"REPLACE" ...
"TRUNCATE" ...
"CAST" ...
"OVER" ...
"PARTITION" ...
"EXTRACT" ...
"MATERIALIZED" ...
"PRIOR" ...
"SIBLINGS" ...
"COLUMN" ...
"NULLS" ...
"FIRST" ...
"LAST" ...
"ROWS" ...
"RANGE" ...
"FOLLOWING" ...
"ROW" ...
"COMMIT" ...
"SEPARATOR" ...
"CASCADE" ...
"NO" ...
"ACTION" ...
<K_DATETIMELITERAL> ...
"PRECISION" ...
<S_IDENTIFIER> ...
<S_QUOTED_IDENTIFIER> ...
at net.sf.jsqlparser.parser.CCJSqlParser.generateParseException(CCJSqlParser.java:16395)
虽不影响页面功能,作为程序员的我们,怎能忍受,于是分析问题,百度解决方案,大部分都说,在sql中将排序语句写死,我认为这不是解决问题,这是妥协,于是开始自己找根本原因,
最后定位问题,net.sf.jsqlparser.parser.ParseException: Encountered " <S_CHAR_LITERAL> "\'send.acceptId\' "" at line 2, column 24.主要在这句。
本人sql:
最后定位是" ' "的问题,语句重构时出现错误,
解决方案很简单,将" ' "换成" " ",则问题解决。