In Oracle I can declare a reference cursor.
but MS-SQL I don't know.
private Connection conn;
private CallableStatement stmt;
private OracleResultSet rset;
stmt = conn.prepareCall("{ ? = call " + call + "}");
stmt开发者_运维知识库.registerOutParameter(1, <b>OracleTypes.CURSOR</b>);
stmt.execute();
rset = (OracleResultSet)stmt.getObject(1);
I'm not an expert on JDBC, but MSSQL doesn't have any direct equivalent of a REF CURSOR: result sets are returned directly from a procedure or query to the client. You don't mention which JDBC driver you're using, but if it's the Microsoft one then working with result sets is well documented.
If that doesn't help, please clarify which JDBC driver you're using and what code you've tried so far.
精彩评论