首页 > 数据库 >### Cause: java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符

### Cause: java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符

时间:2023-01-14 10:01:22浏览次数:69  
标签:serv java SQLSyntaxErrorException no loi2 sql date org


前言

使用MyBatis进行SQL查询,报出SQL异常,原因为SQL语句最后结束加了分号(? )(?)

### Cause: java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符_java

org.springframework.jdbc.BadSqlGrammarException: 
### Error querying database. Cause: java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符

### The error may exist in com/df/dao/RunOverviewMapper.java (best guess)
### The error may involve com.df.dao.RunOverviewMapper.selectRunOverview-Inline
### The error occurred while setting parameters
### SQL: select * from ( select tmp_page.*, rownum row_id from ( SELECT tmp2.*, (SELECT COUNT (*)FROM DSGC_LOG_INSTANCE loi2 WHERE loi2.serv_no = tmp2.serv_no AND loi2.inst_status = '1' and loi2.START_TIME between to_date('2019-05-07','yyyy-mm-dd')AND to_date('2019-05-07 23:59:59','yyyy-mm-dd hh24:mi:ss')+1) AS suc_num, (SELECT COUNT (*)FROM DSGC_LOG_INSTANCE loi2 WHERE loi2.serv_no = tmp2.serv_no AND loi2.inst_status = '0' and loi2.START_TIME between to_date('2019-05-07','yyyy-mm-dd')AND to_date('2019-05-07 23:59:59','yyyy-mm-dd hh24:mi:ss')+1) AS fail_num FROM(SELECT tmp.*, os1.serv_name,os1.serv_no FROM (SELECT serv_id,NVL(ROUND ((SUM (timediff)/1000) / DECODE (SUM (run_times),0,1,SUM (run_times)),2),0) AS AVE_TIME,NVL(MAX (timediff),0) AS max_resp_time,NVL(MIN (timediff),0) AS min_resp_time,MAX (creation_date) create_date,COUNT (run_times) total_num FROM(SELECT os.serv_id,os.serv_no,os.serv_name,run_times,EXTRACT (SECOND FROM(end_time - start_time) ) * 1000 AS timediff,os.creation_date FROM DSGC_SERVICES os LEFT JOIN DSGC_LOG_INSTANCE loi1 ON os.serv_no = loi1.serv_no where os.serv_status = '1'AND loi1.START_TIME >= to_date('2019-05-07','yyyy-mm-dd') AND loi1.START_TIME <=to_date('2019-05-07 23:59:59','yyyy-mm-dd hh24:mi:ss')+1)GROUP BY serv_id) tmp,DSGC_SERVICES os1 WHERE tmp.serv_id = os1.serv_id) tmp2 ORDER BY tmp2.serv_id desc; ) tmp_page where rownum <= ? ) where row_id > ?
### Cause: java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符

; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符

at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:91)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
at com.sun.proxy.$Proxy92.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230)
at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:137)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
at com.sun.proxy.$Proxy146.selectRunOverview(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)

解决

删除,别加了

祝你幸福

送你一首歌《Way Back Home》 Way Back Home​​

附图:甘肃庆阳

### Cause: java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符_spring_02


### Cause: java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符_SQL_03


标签:serv,java,SQLSyntaxErrorException,no,loi2,sql,date,org
From: https://blog.51cto.com/u_15939406/6007239

相关文章

  • (五)Java集合
    Java集合1、Java集合(容器)Java容器分为Collection和Map两大类,各自都有很多子类。Collections是一个包装类,包含有关集合的各种静态方法,不能被实例化,Collections集合......
  • Java获取两个日期之间的所有月份
    publicstaticList<String>getMonthBetweenDate(StringstartTime,StringendTime){SimpleDateFormatsdf=newSimpleDateFormat("yyyy-MM");//......
  • Java 计算经纬度是否在某个范围之内
    /***计算地球上任意两点(经纬度)距离**@paramlong1前端传入的打卡第一点经度*@paramlat1前端传入的打卡第一点纬度*@paramlong2范围之内的第二点经......
  • SQL_11_数据库设计范式
    为了建立冗余较小、结构合理的数据库,设计数据库时必须遵循一定的规则,即为范式。 第一范式:列不可再分割,保证其具有原子性。第二范式:表中每一列都和主键相关,......
  • MySQL_3_执行计划
    MySQL的核心是存储引擎。  一、查询过程1、客户端向MySQL服务器发送查询请求。2、检查查询缓存,缓存命中直接返回数据,否则进入下一阶段。3、服务器进......
  • JavaScript字符串的常用方法
    一、操作方法我们也可将字符串常用的操作方法归纳为增、删、改、查,需要知道字符串的特点是一旦创建了,就不可变增这里增的意思并不是说直接增添内容,而是创建字符串的一个......
  • java基础06 变量、常量、作用域
    变量、常量、作用域变量variable变量:variablejava变量是程序中最基本的存储单元,其要素包括:变量名(标识符)、变量类型(数据类型)、作用域可以变化的量代表一片存储空间(这......
  • mysql在centos7中的安装
    1.执行以下命令,下载并安装MySQL官方的YumRepository。wgethttp://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpmyum-yinstallmysql57-community......
  • Sqlmap简单用法
    判断是否存在注入sqlmap-uurlsqlmap基础判断文本中的请求是否存在注入查询当前用户下的所有数据库--dbs(获取所有数据库信息)获取数据库中的表名-D数据库--tabl......
  • In aggregated query without GROUP BY...this is incompatible with sql_mode=only_f
    数据库查询时,出现如下错误:Causedby:com.mysql.jdbc.exceptions.jdbc4MySQLSyntaxErrorException:InaggregatedquerywithoutGROUPBY,expression#1ofSELECTlist......