CREATE procedure splitPage
@strSQL nvarchar(4000), --查询字符串 
@PageIndex int, --第N页 
@PageSize int --每页行数 
as 
set nocount on 
declare @P1 int, --P1是游标的id 
@rowcount int 
exec sp_cursoropen @P1 output,@strSQL,@scrollopt=1,@ccopt=1,@rowcount=@rowcount output 
--select ceiling(1.0*@rowcount/@PageSize) as pageCount,@rowcount as recCount,@PageIndex as curPage
set @PageIndex=(@PageIndex-1)*@PageSize+1 
exec sp_cursorfetch @P1,16,@PageIndex,@PageSize 
exec sp_cursorclose @P1 
set nocount off
GO急急急!!!我在Jsp(Java)中怎样返回存储过程的多个记录集??
String sql = "{call splitPage(?,?,?)}"; //返回两个记录集 ,第一为空
        spstmt = con.prepareCall(sql);     
        spstmt.setString(1,sSQL);
        spstmt.setInt(2,pageIndex);
        spstmt.setInt(3,pageSize); 
//(2)执行存储过程
        spstmt.execute();  
        //(3)跳过第一个记录集
        spstmt.getMoreResults(); //这个记录集为空
//(4)得到第二个记录集
        spstmt.getMoreResults();         
        ResultSet rs = spstmt.getResultSet(); //???怎么不对???