我先在orcale數據庫中寫了一個算法包,裡面的算法都用pl/sql developer 測試過是正確的,但是我放在程序中調用的時候老是處錯。
  java.sql.SQLException: ORA-01861: ?????????
  ORA-06512: ? "CIU.NB_PREMIUMPOSTINGCALCULATE", line 393
  ORA-06512: ? line 1可我真的不知道如何改了,程序如下:
 jdbcFacade 是一個數據庫連接的類,方法已經寫好了,隻是把JDBC中的方法組合了一下;import JproInsure.JproBean.jdbcfacade.common.*; -- 數據庫連接
import java.sql.*;
public class myDB {
      PJdbcFacade  jdbcFacade =PJdbcFacade.newInstance(); -- 實例一個連接
    /** Creates a new instance of myDB */
         float[] getCommissionWhenRateLostFocus(float commissionRate01, float commissionRate02, float commissionRate03,
                  String companyID, String branchID,String agentCode,String productCode,
                  String effectiveFromDate,float  postedgrosspremium,String premiumClassCode) throws java.sql.SQLException{
                                 
                boolean bool = jdbcFacade.executeCallSql("{ call nb_premiumPostingCalculate.setPostedCommission(?,?,?,?,?,?,?,?,?,?)}",
                  new Object[]{ new Float(commissionRate01),new Float(commissionRate02),new Float(commissionRate03), 
                   companyID,branchID, agentCode,productCode,effectiveFromDate,new Float(postedgrosspremium), premiumClassCode});
                
                
            }
         
          public static void main(String args[]) {
               myDB db = new myDB();
               try{
                   db.getCommissionWhenRateLostFocus(Float.parseFloat("1") ,Float.parseFloat("25") , Float.parseFloat("15") , "CIU" , "AA" , "AA00000011" , "Product 1" , "20030101" , Float.parseFloat("200") , "PremClass2");       
               }catch(SQLException e){e.printStackTrace();}
         }
    
}

解决方案 »

  1.   

    估计是你连接的用户不对吧,NB_PREMIUMPOSTINGCALCULATE这个函数是用户CIU创建的吗?
      

  2.   

    ORA-01861 literal does not match format stringCause: Literals in the input must be the same length as literals in the format string (with the exception of leading white space). If the "FX" modifier has been toggled on, the literal must match exactly, with no extra white space.Action: Correct the format string to match the literal.
    这个里面说的是空格的问题。我虽然不是很懂JAVA,但是看了你的代码,
                    boolean bool = jdbcFacade.executeCallSql("{ call nb_premiumPostingCalculate.setPostedCommission(?,?,?,?,?,?,?,?,?,?)}",
                      new Object[]{ new Float(commissionRate01),new Float(commissionRate02),new Float(commissionRate03), 
                       companyID,branchID, agentCode,productCode,effectiveFromDate,new Float(postedgrosspremium), premiumClassCode})
    我不知道为什么其他变量可以直接引用,为什么类型为Float的要new.看看是不是这个问题。