public static void main(String[] args)
  {    
    String s = "38, 17, 41, 45, 40, 43, 44, 48, 42, 47";
ResultSet rs = null;
try
  {
new oracle.jdbc.driver.OracleDriver();
    Connection conn = DriverManager.getConnection(
        "jdbc:oracle:thin:@localhost:1521:oracle9i", "scott", "tiger");
    CallableStatement stmt = conn.prepareCall(" {call get_exam_pro(?, ?) }");
    
    stmt.setString(1, s);
    stmt.registerOutParameter(2, oracle.jdbc.OracleTypes.CURSOR);
    stmt.execute();
  }
  catch (SQLException e)
  {
    System.err.println(e);
  }
  }create or replace procedure get_exam_pro(v_id_list in varchar2, p_cursor out exam_package.exam_cursor) 
is
begin
 open p_cursor for select * from  question where id in v_id_list;
end;

解决方案 »

  1.   

    啥错误?错误信息呢?
    create or replace procedure get_exam_pro(v_id_list in varchar2, p_cursor out TESTPACKAGE.Test_CURSOR) 
    is
    begin
     open p_cursor for select * from  question where id in v_id_list;
    end;
      

  2.   

    你是要存储过程返回值吧? 那么你的语法不正确。{?  =  call  过程名[(?,  ?,  ...)]}  
    这样。
      

  3.   

    mt.execute();
    这句提示错误.
    第2个?是我要的东西.是一个cursor出这个错
    2006-9-30 16:03:09 java.util.jar.Attributes read
    警告: Duplicate name in Manifest: Class-Path
    2006-9-30 16:03:09 java.util.jar.Attributes read
    警告: Duplicate name in Manifest: Class-Path
    2006-9-30 16:03:09 java.util.jar.Attributes read
    警告: Duplicate name in Manifest: Class-Path
    2006-9-30 16:03:09 java.util.jar.Attributes read
    警告: Duplicate name in Manifest: Class-Path
    2006-9-30 16:03:09 java.util.jar.Attributes read
    警告: Duplicate name in Manifest: Class-Path
    2006-9-30 16:03:09 java.util.jar.Attributes read
    警告: Duplicate name in Manifest: Class-Path
    2006-9-30 16:03:09 java.util.jar.Attributes read
    警告: Duplicate name in Manifest: Class-Path
    Exception in thread "main" java.lang.NullPointerException
            at oracle.jdbc.ttc7.TTCAdapter.newTTCType(TTCAdapter.java:270)
            at oracle.jdbc.ttc7.TTCAdapter.createNonPlsqlTTCColumnArray(TTCAdapter.j
    ava:256)
            at oracle.jdbc.ttc7.TTCAdapter.createNonPlsqlTTCDataSet(TTCAdapter.java:
    231)
            at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1412)
            at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:862
    )
            at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.ja
    va:1846)
            at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.jav
    a:1771)
            at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
    nt.java:2361)
            at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePrepar
    edStatement.java:422)
            at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStat
    ement.java:487)
            at test.test.main(test.java:25)
    Press any key to continue...