Orcale 分页可以看一下这一篇 简单搞一下 Oracle 存储过程动态SQL之获取查询分页!
先简单试一下
SELECT * FROM
(
SELECT ROW_NUMBER() OVER (ORDER BY id desc)AS Row, * from test
)as temp where Row between 1 and 10
看来还行......
继续改写一下:
declare
@v_index int,
@v_size int
begin
set @v_index = 1;
set @v_size = 10;
SELECT * FROM
(
SELECT ROW_NUMBER() OVER (ORDER BY id desc)AS Row, * from test
)
as temp where Row
between (@v_index-1)*@v_size+1and (@v_index-1)*@v_size+@v_size
end;