ALTER PROCEDURE dbo.Sp_TeamInfo_FetchTeam@pageindex int--第N页as
declare @pagesize int
set @pagesize=25
declare @docount bigint
select @docount=count(*) from TeamView
if @docount=@pagesize
select * from TeamView
else
begin
declare @indextable table(id int identity(1,1),nid int)
declare @PageLowerBound int
declare @PageUpperBound int
set @PageLowerBound=(@pageindex-1)*@pagesize
set @PageUpperBound=@PageLowerBound+@pagesize
set rowcount @PageUpperBound
insert into @indextable(nid) select id from TeamView
select a.* from TeamView a,@indextable t where a.id=t.nid
and t.id>@PageLowerBound and t.id<=@PageUpperBound
end
解决方案 »
- 为什么erwin报错ora00942表或视图不存在。。
- ora-03113 通信通道的文件结束
- oracle怎么批量处理insertsql?
- oracle里怎么实现跟Sql Server相同的定时任务调度?请高手帮忙写个例子
- Oracle817为什么创建数据库失败?
- 创建数据库时出错
- 新手的几个问题
- ora-01041错误,采用Delphi的BDE或Ado连接错误,在线等待,提供解决方法,有分!
- 请教高手:实现一个从3300万记录中汇总排序查询,需把sort_area_size设置为多大合适?能否超过shared_pool_size?这有什么规定?(急!!
- 请高手们救命,高分提供,解决web方式下的oracle数据库的备份和恢复的问题。
- where子句中带日期字段的查询优化
- 在SQL Plus中如何指定一个数据库实例
public String On(int prmPgeNo) throws SQLException
{
//**基础信息处理***************
//--页数处理
if (prmPgeNo<=0)
{
prmPgeNo=1;
}
//--取得页数和总记录数
this.GetPgeCountAndRcdcount(); if (prmPgeNo > this.PgeCount)
{
prmPgeNo= this.PgeCount;
}
this.PgeNo = prmPgeNo; int frtSeltop=this.perPgeRows*prmPgeNo;
//--检查是否到了最后一个页
int scdSeltop=this.perPgeRows;
if (prmPgeNo==this.PgeCount)
{
scdSeltop=this.RcdCount-this.perPgeRows*(this.PgeCount-1);
} //***************** //**取得Sql语句,根据不同的数据库方式
String strSql="";
//--如果是Oracle
if (this.DbType.equals("oracle"))
{
int startrow = this.perPgeRows*(prmPgeNo-1); //开始的记录号
int endrow = this.perPgeRows*(prmPgeNo); //结束的记录号 String SqlPge="Select "+this.FldLst+" From "+this.TbName+" Where "+this.SelWhr+" "; strSql="SELECT "+this.FldLst+" from "+this.TbName+" Where "+this.SelWhr+" order by "+this.FirstSortFlds+" ";
strSql="select RowNum rid,A.* from ( "+strSql+") A WHERE RowNum<="+endrow;
strSql="select * from ("+strSql+") where rid>"+startrow;
}
//--如果是Sqlserver
else if (this.DbType.equals("sqlserver"))
{
strSql="select * from (select top "+scdSeltop+" "+this.OverFldLst+" from (select top "+frtSeltop+" "+this.FldLst+" from "+this.TbName+" where "+this.SelWhr+" order by "+this.FirstSortFlds +" ) T order by "+this.SecendSortFlds+" desc ) A order by "+this.SecendSortFlds+" desc ";
this.ErrMsg=strSql;
}
return strSql;
}