惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
The GitHub Blog
The GitHub Blog
C
Check Point Blog
博客园_首页
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
F
Full Disclosure
Microsoft Security Blog
Microsoft Security Blog
爱范儿
爱范儿
Recent Announcements
Recent Announcements
阮一峰的网络日志
阮一峰的网络日志
G
GRAHAM CLULEY
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Threat Research - Cisco Blogs
C
Cybersecurity and Infrastructure Security Agency CISA
V
Vulnerabilities – Threatpost
K
Kaspersky official blog
博客园 - 司徒正美
S
Schneier on Security
T
The Exploit Database - CXSecurity.com
Project Zero
Project Zero
云风的 BLOG
云风的 BLOG
Cisco Talos Blog
Cisco Talos Blog
Know Your Adversary
Know Your Adversary
雷峰网
雷峰网
V
V2EX - 技术
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Spread Privacy
Spread Privacy
罗磊的独立博客
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
SecWiki News
SecWiki News
Schneier on Security
Schneier on Security
O
OpenAI News
Jina AI
Jina AI
PCI Perspectives
PCI Perspectives
Cyberwarzone
Cyberwarzone
Y
Y Combinator Blog
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog RSS Feed
I
InfoQ
D
Docker
P
Palo Alto Networks Blog
Recorded Future
Recorded Future
M
MIT News - Artificial intelligence
博客园 - Franky
B
Blog
Scott Helme
Scott Helme
博客园 - 叶小钗
D
DataBreaches.Net

博客园 - 东方新秀

Unix系统启动时进程介绍 Oracle定期运行数据 linux下如何用脚本实现自动ftp linux shell 自动处理ftp操作探讨 linux shell 自动处理ftp操作探讨 从Oracle数据库中导出SQL脚本 crontab无法正常运行的原因分析 手工创建Oracle数据库脚本及说明(转载) 利用Crontab实现对Oracle数据库的定时备份(转载) 一个不错了健康知识网 Oracle学习之二(用游标解决数组问题) Oracle学习 国人开发的异构数据库(Java实现的数据库) 2007年7月最受关注的20篇技术文章!(转载本文,请注明出处为CSDN) 英语在线词典 oracle帮助文档 查离有效期至多只有七天的商品的商品 oracle日期处理 Oracle求求空间使用情况
Oracle分页存储过程(转)
东方新秀 · 2007-07-15 · via 博客园 - 东方新秀

create or replace package PKG_Tools
   is
   type ResultData is ref cursor;
   procedure sp_Page(p_PageSize int,          --每页记录数
                    p_PageNo int,            --当前页码,从 1 开始
                      p_SqlSelect varchar2,    --查询语句,含排序部分
                      p_SqlCount varchar2,     --获取记录总数的查询语句
                     p_OutRecordCount out int,--返回总记录数
                      p_OutCursor out ResultData);
  
  
  end PKG_Tools;
   /

create or replace package body PKG_Tools
   is
   procedure sp_Page(p_PageSize int,          --每页记录数
                     p_PageNo int,            --当前页码,从 1 开始
                     p_SqlSelect varchar2,    --查询语句,含排序部分
                     p_SqlCount varchar2,     --获取记录总数的查询语句
                     p_OutRecordCount out int,--返回总记录数
                     p_OutCursor out ResultData)
     as
         v_sql varchar2(3000);
         v_count int;
         v_heiRownum int;
         v_lowRownum int;
    begin
     ----取记录总数
      execute immediate p_SqlCount into v_count;
      p_OutRecordCount := v_count;
     ----执行分页查询
      v_heiRownum := p_PageNo * p_PageSize;
      v_lowRownum := v_heiRownum - p_PageSize +1;
   
       v_sql := 'SELECT *
               FROM (
                      SELECT A.*, rownum rn
                     FROM  ('|| p_SqlSelect ||') A
                     WHERE rownum <= '|| to_char(v_heiRownum) || '
                    ) B
                WHERE rn >= ' || to_char(v_lowRownum) ;
               --注意对rownum别名的使用,第一次直接用rownum,第二次一定要用别名rn
  
   OPEN p_OutCursor FOR  v_sql;
 
  end sp_Page;
 
  end PKG_Tools;
  /