open cur_out_2 for
SELECT * FROM userinfo where id <5;
end P_Sel_TopCount2;
www.2cto.com
简单地写一个Java Class.
public void openCursor(){
Connection cOnn= null;
ResultSet rs = null;
CallableStatement stmt = null;
String sql = “{? = call PKG_HOTLINE.getHotline()}“;
try{
cOnn= getConnection();
stmt = conn.prepareCall(sql);
stmt.registerOutParameter(1,
OracleTypes.CURSOR);
stmt.registerOutParameter(2,OracleTypes.CURSOR);
stmt.execute();
rs = ((OracleCallableStatement)stmt).getCursor(1);
while(rs.next()){
String country = rs.getString(1);
String pno = rs.getString(2);
System.out.println(“country:“+country+“|pno:”+pno);
} www.2cto.com
rs = ((OracleCallableStatement)stmt).getCursor(2);
while(rs.next()){
String country = rs.getString(1);
String pno = rs.getString(2);
System.out.println(“country:“+country+“|pno:”+pno);
}
}
catch(Exception ex)
{
ex.printStackTrace();
}
finally
{
closeConnection(conn,rs,stmt);
}
}
作者 kavy