strQuery =" update "+dbInfo.getDB4SQL()+"temp_detail "
         +" set a1 = (select NVL(sum(foe03f),0) from "+dbInfo.getDB4SQL()       +"fom05 "
+" where foe00c = '"+args[0].trim()+"' and fpd01c = foe01c and reportid= '"+reportid+"');";
語句時沒問題的

解决方案 »

  1.   

    dbinfo.getDB4SQL()是一個得到username 的方法,reportid是一個string
      

  2.   

    connSP = DataConnection.getConnection("DBA_PaymentDetail.getSimpleResult()",dbInfo);
    stmtSP = connSP.createStatement();
                
    stmtSP.execute(strQuery);
    strQuery =" update "+dbInfo.getDB4SQL()+"temp_detail "
             +" set a1 = (select NVL(sum(foe03f),0) from "+dbInfo.getDB4SQL()+"fom05 "
    +" where foe00c = '"+args[0].trim()+"' and fpd01c = foe01c and reportid = '"+reportid+"');";
    stmtSP.executeUpdate(strQuery);
      

  3.   

    DataConntion是我們公司自己的class
      

  4.   

    有原因,也在于你的SQL语句由于是拼接的,所以,在前后拼接点上,会产生空格的遗忘。
    例如:select * from tablewhere ...仔细检查。
    好的习惯,字符串前后加空格。
      

  5.   

    将这条语句放到SQL*Plus下去运行,并且分行进行,这样容易发现错误
      

  6.   

    這條語句在worksheet中運行是對的,我到sol*plus中去試試
      

  7.   

    你的语句在DB上执行前,打一个Log出来,内容是你的SQL语句。
    (不要你自己写好的理想中的SQL语句去执行)看看这句SQL文行不行。我直觉
    是语句本身的语义没错,语法错了。也就是,你在执行前,真正执行的语句
    有问题。