报错如下:
java.lang.Exception: {Ams}org.springframework.jdbc.BadSqlGrammarException: SqlMapClient operation; bad SQL grammar []; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred while applying a parameter map.
--- Check the ycHdexamine.getOrderYchdByPage-InlineParameterMap.
--- Check the statement (update procedure failed).
--- Cause: com.sybase.jdbc3.jdbc.SybSQLException: Incorrect syntax near '2008'.
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred while applying a parameter map.
--- Check the ycHdexamine.getOrderYchdByPage-InlineParameterMap.
--- Check the statement (update procedure failed).
--- Cause: com.sybase.jdbc3.jdbc.SybSQLException: Incorrect syntax near '2008'.
错误中的2008应该是指页面中的时间:
控制台sql的执行输出:
{ call ams_query_page ( ' select aa.* from ( select workid workId, orgrowid, orgName, objectNo, objectName, objectRowid, userNo, userRowId, userName, measurepointId ,measurepointrowId, measurepointName, alarmType, zdType, alagf, dateData, ischeck, dataValue, remark from order_ychd where alarmType = 1 and dateData >= '2008-09-19' and dateData < '2013-09-25' ) aa ' ,0 , 50 ) } ;红色部分是当参数传进来的,所以里面的两个日期要用双引号。
而改为双引号重启服务器之后,又报另一个错:Caused by: com.sybase.jdbc3.jdbc.SybSQLException: Invalid column name '2013-09-25'. ;
请看Sybase-Invalid column name '2013-09-25'.