Oracle分页抽数存储过程

--outTotal是需要返回的总数,v_loginUserId是传入的登录人ID,抽取他的客户,v_CurrPage是传入的第几页,v_pageSize传入的每页数据条数。
 SELECT nvl((SELECT count(1)
                   FROM tb_cus_customerinfo tc
                  where tc.f_manageuserid = v_loginUserId),
                 0)
        into fCount
        FROM dual;   
      outTotal := fCount;
    


       SELECT ttt.*
          FROM (select tt.*, rownum as f_index
                  from (SELECT A.*
                          FROM tb_cus_customerinfo A
                         WHERE A.f_manageuserid = v_loginUserId
                         order by f_createtime desc) tt) ttt
         where ttt.f_index > (v_CurrPage - 1) * v_pageSize
           and ttt.f_index <= v_CurrPage * v_pageSize;

这里只截取一部分关键代码,记录一下分页抽数过程。

posted @ 2019-03-05 14:13  lvanka  阅读(325)  评论(0编辑  收藏  举报