程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> ora-Caused by: java.sql.SQLException: ORA-00911: 無效字符

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)"
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved