ora-Caused by: java.sql.SQLException: ORA-00911: 无效字符

问题描述

Caused by: java.sql.SQLException: ORA-00911: 无效字符
if(stat){
        sqlsb.append(" select * from (");
    }else{
        sqlsb.append("select count(*) from (");
    }
    sqlsb.append("select bb.datetime datetime,  sum(decode(bb.typevalue, '新入金', bb.inits, 0.0)) as inits1, " +
            "  sum(decode(bb.typevalue, '还款本金', bb.inits, 0.0)) as inits2, " +
            "  sum(decode(bb.typevalue, '赎回金额', bb.inits, 0.0)) as inits3, " +
            "  sum(decode(bb.typevalue, '借款金额', bb.inits, 0.0)) as inits4, " +
            "  sum(decode(bb.typevalue, '历史空闲资金', bb.inits, 0.0)) as inits5  from   (select to_char(t.start_date, 'yyyy-MM-dd') datetime, " +
            "  sum(t.amount) inits, '新入金' typevalue   from p2p_investment_capitalinfo t  where t.type = 02 " +
            "  and t.status in (01, 02, 03)  group by to_char(t.start_date, 'yyyy-MM-dd')  " +
            "  union all   select to_char(t.create_date, 'yyyy-MM-dd') datetime,  sum(t.split_capital) inits,  " +
            "  '还款本金' typevalue from clspuser.crf_p2p_capital_split_main t  where t.capital_type = 1 " +
            "  group by to_char(t.create_date, 'yyyy-MM-dd')    union all    select to_char(t.pay_date, 'yyyy-MM-dd')  datetime," +
            "  sum(t.amount) inits,  '赎回金额' typevalue   from p2p_investment_payinfodetail t       where t.is_transfer is null" +
            "  group by to_char(t.pay_date, 'yyyy-MM-dd')       union all    select to_char(t.match_date, 'yyyy-MM-dd') datetime," +
            "  sum(t.amount) inits,  '借款金额' typevalue   from p2p_investment_capital_debt t        where t.status != 06" +
            "  and t.redempt_number is null    group by to_char(t.match_date, 'yyyy-MM-dd')     union all     select to_char(t.start_date, 'yyyy-MM-dd') datetime," +
            "  sum(t.amount - nvl(t.handled_amount, 0)) inits,  '历史空闲资金' typevalue     from p2p_investment_capitalinfo t   where t.pri_number != 247478" +
            "  and t.status in (01, 02)  and t.type = 01  and t.investor_number != 165951   group by to_char(t.start_date, 'yyyy-MM-dd'))bb  where 1=1" );
    //创建时间段查询
    if(null !=po.getStartAppDate()){
        sqlsb.append("  and bb.datetime >= '"+po.getStartAppDate()+"'");
    }
    if( null != po.getEndAppDate()) {
        sqlsb.append("  and bb.datetime <= '"+po.getEndAppDate()+"'");
    }
    sqlsb.append(" group by bb.datetime   order by bb.datetime desc);");

    String sqlStr = this.getInternalAccountMoneyWarningsql(po,false);
    SQLQuery sq = this.getSession().createSQLQuery(sqlStr);
    在oracle没有错 但是hibernate 执行sql出现Caused by: java.sql.SQLException: ORA-00911: 无效字符

解决方案

 order by bb.datetime desc);"看着这最后一个;多余了,去掉试试
 改成
 order by bb.datetime desc)"

解决方案二:

SQLException一般是sql语句的问题
检查有没有误用全角符号,还有查询中有没有包含特殊字符,使用的代码页是否正确。

解决方案三:

在数据库执行代码没错,hibernate执行sql错了,最大可能就是因为你将这些语句拼的时候拼错了。。。

时间: 2024-09-01 14:28:24

ora-Caused by: java.sql.SQLException: ORA-00911: 无效字符的相关文章

Caused by: java.sql.SQLException: ORA-01861: 文字与格式字符串不匹配

          项目中遇到这样一个问题:                 Caused by:java.sql.SQLException: ORA-01861: 文字与格式字符串不匹配 atoracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) atoracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331) atoracle.jdbc.

Caused by: java.sql.SQLException: 数字溢出

问题描述 Causedby:java.sql.SQLException:数字溢出atoracle.jdbc.driver.NumberCommonAccessor.throwOverflow(NumberCommonAccessor.java:4380)atoracle.jdbc.driver.NumberCommonAccessor.getInt(NumberCommonAccessor.java:111)atoracle.jdbc.driver.OracleResultSetImpl.get

jdbc-java.sql.SQLException: ORA-04098: 触发器无效且未通过重新验证

问题描述 java.sql.SQLException: ORA-04098: 触发器无效且未通过重新验证 我创建触发器的语句: create or replace trigger TRIG_DAT_DD before insert on DAT_DD_TEMP for each row begin SELECT DAT_DD_SEQ.NEXTVAL INTO : NEW.ID FROM DUAL;end TRIG_DAT_DD; insert into select from 语句: inser

java.sql.SQLException: Io 异常: 连接超时

问题描述 帮我看看咋回事啊?我搞不懂.就是运行很久的一个项目,最近突然就动不动就登陆不了,然后连首页都显示不出来了.然后只能重启服务,就又没问题了.老师需要重启.帮我看看日志全是这个,是什么意思啊?ERROR 2013-12-06 13:12:20,831 org.logicalcobwebs.proxool.GAP-Pool #0041 encountered errors during destruction: java.sql.SQLException: Io 异常: 连接超时at ora

求教关于“java.sql.SQLException 列名无效”的问题

问题描述 使用DBUtil查询数据库时Java报列名'lei_xing'无效.但是这个SQL语句在MSSQL的控制台下面能够争取执行.到底是什么原因啊?这是查询部分的代码:Stringsql="selecttg.fid,tg.intime,tg.lei_bie,tg.ftitle,tg.inpart,tg.inname,jl.idfromtonggaotgleftjoin(selectid,fidfromyue_du_ji_luywherelei_xing=?)jlontg.fid=jl.fid

spring-Could not obtain connection metadata java.sql.SQLException: Io exception

问题描述 Could not obtain connection metadata java.sql.SQLException: Io exception 启动tomcat的时候就报下面的错.求大神指引....... 谢谢 [INFO] - Initializing connection provider: org.springframework.orm.hibernate3.TransactionAwareDataSourceConnectionProvider 2013-07-08 16:2

hibernate proxool java.sql.SQLException

问题描述 大家好,我现在在项目中使用了hibernate来连接数据库,使用到的连接池是proxool,但奇怪的是,在tomcat的日志中,每隔一定时间就会出现以下信息:09:02:35,768 DEBUG fm_oracleproxool:431 - 009441 (00/09/00) - #7920 removed because it has problems: java.sql.SQLException: ORA-00923: 未找到要求的 FROM 关键字09:02:36,407 DEB

mysql java.sql.SQLException 问题

问题描述 mysql java.sql.SQLException 问题 java.sql.SQLException: We are already in the process of making 20 connections and the number of simultaneous builds has been throttled to 19 这是什么问题,大家帮我解决下,急. . . 解决方案 并发的线程过多,已经超过你设置的连接数,同时强调一点,设置的连接数可能会对你的系统的性能有一

数据库一添加-java.sql.SQLException: 列名无效

问题描述 java.sql.SQLException: 列名无效 表单添加的时候数据库能正常添加这一行,但是控制台上还是会报 java.sql.SQLException: 列名无效 这个错误?请问怎么回事啊~~~急 //插入方法 public void insert(HttpServletRequest request, HttpServletResponse response) throws ClassNotFoundException, SQLException{ Connection co