我通过java 调用存储过程 其中传3个参数 都是ARRAY类型 oracle这里自定义过了其中两个in 一个out
这个程序对于数据量不是很大的情况下没有问题 但是当我其中in的两个list达到几万的时候就会报错
java.sql.SQLException: 超出 VARRAY 的最大限制问题:如果是VARRAY 定义的时候max_size太小的话我扩大过了 我定义的是4000 不知道最大是多少 当然我在不知情的情况下也扩充到过20000大小但是还是不对 请大虾指教
下面是调用的
Connection connection = this.getConnection(); CallableStatement proc = null; // 存储过程使用的Statement
String sql = "{call prc_iatafee(?,?,?)}";// 存储过程的SQL语句
try {
proc = connection.prepareCall(sql);
((OracleCallableStatement) proc).setARRAY(1, iatafees);
((OracleCallableStatement) proc).setARRAY(2, iatas);
proc.registerOutParameter(3, Types.ARRAY, "ERRFEELIST");
proc.execute(); ARRAY errARRAY = (ARRAY) proc.getArray(3);
ArrayList errorlist = this.getErrfeesArray(errARRAY);
log.info("callIataPrc end!!!");
return errorlist;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;

解决方案 »

  1.   

    java.sql.SQLException: 超出 VARRAY 的最大限制 
       -----报的是SQL的异常,看看你的procedure吧.
      

  2.   

    超过最大限制了,在程序端把ARRAYLIST分解一下。比如1000条调用一次存储过程。为什么list会有几万条数据呢?
      

  3.   

    分解也不方便啊 比较麻烦
    本来就是批量做的
    两个list 在存储过程里面要做的卡尔积的
    数据量本来就很大的
    如果1000调一次的话 如果10000*10000  你说要分几个好了 10*10 就是100次调用存储过程阿还有我想问下 VARRAY最大可以设置多少max_size
      

  4.   

    你ORACLE中ARRAY定义的语句贴出来。
      

  5.   

    -- ORACLE最新文档中的信息:
    The allowed subscript ranges are:For nested tables, 1..2147483647 (the upper limit of PLS_INTEGER).For varrays, 1.. size_limit, where you specify the limit in the declaration (size_limit cannot exceed 2147483647).For associative arrays with a numeric key, -2147483648..2147483647.For associative arrays with a string key, the length of the key and number of possible values depends on the VARCHAR2 length limit in the type declaration, and the database character set.
      

  6.   

    CREATE OR REPLACE Type feeProptype As Object
    (
      Id  Integer,
    Tac_Subsource_Id Integer,
    Tac_Prop_Id      Integer,
    Tac_Plan_Info_Id Integer,
    Date_Type        Varchar2(1),
    Begin_Date       Date,
    End_Date         Date,
    Tac_Commision_Id Integer,
    Level_No         Varchar2(1),
      creator          Varchar2(40))
    CREATE OR REPLACE TYPE feeproplist AS VARRAY(4000) OF feeproptype
      

  7.   

    那我size_limit 改称10万试一下好来 
    是不是我jdbc驱动也要改一下阿 我原来用的是thin的