qq_27478049 2015-05-26 02:42 采纳率: 100%
浏览 2960
已采纳

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: 无效字符
  • 写回答

3条回答 默认 最新

  • danielinbiti 2015-05-26 02:47
    关注
     order by bb.datetime desc);"看着这最后一个;多余了,去掉试试
     改成
     order by bb.datetime desc)"
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥200 求能开发抖音自动回复卡片的软件
  • ¥15 关于freesurfer使用freeview可视化的问题
  • ¥100 谁能在荣耀自带系统MagicOS版本下,隐藏手机桌面图标?
  • ¥15 求SC-LIWC词典!
  • ¥20 有关esp8266连接阿里云
  • ¥15 C# 调用Bartender打印机打印
  • ¥15 我这个代码哪里有问题 acm 平台上显示错误 90%,我自己运行好像没什么问题
  • ¥50 C#编程中使用printDocument类实现文字排版打印问题
  • ¥15 找会编程的帅哥美女 可以用MATLAB里面的simulink编程,用Keil5编也可以。
  • ¥15 已知隐函数其中一个变量τ的具体值,求另一个变量