首先,你要确定你的数据集是用游标返回的如果是Oracle数据库,可以用OracleCallableStatement的OracleType.Cursor

解决方案 »

  1.   

    ResultSet rs=null;
    CallableStatement cstat=null;
    try{
    cstat = connect.prepareCall("{CALL my_sp_month(?, ?, ?)}");cstat.setInt(1, 2);
    cstat.setInt(2, 2004);
    cstat.setInt(3, 8);rs = cstat.executeQuery();
    while(rs.next())
    {System.out.println("XX="+rs.getString("month");)
    }
    }catch(Exception e)
    {}用exec也可以不过我遇到了个问题就是,当存储过程有返回值(如return 0)并且还有resultSet时,如何将两者都取到?try {
          procedure = "{?=CALL up_get_Sysrole_authobj (?) }";
          stm = conn.prepareCall(procedure);      //设置参数
          stm.setLong(1,java.sql.Types.NUMERIC)
          stm.setString(2, arid);      long backVal=stm.getLong(1);
          rs = stm.executeQuery();}是不行的....望高手指教.