Instances that use oracle Stored Procedure Paging

Source: Internet
Author: User

Using oracle stored procedures can also achieve paging. Here is an example of using oracle Stored Procedure paging. If you are interested in oracle stored procedures, take a look.

A small example of using oracle Stored Procedure paging:
1. Create a package. As follows:

 
 
  1. CREATE OR REPLACE PACKAGE TESTPACKAGE AS   
  2.  
  3. TYPE Test_CURSOR IS REF CURSOR;   
  4.  
  5. end TESTPACKAGE;   

2. Create a stored procedure:

 
 
  1. create or replace procedure TESTC(p_CURSOR out TESTPACKAGE.Test_CURSOR,lowerNum in numeric,higherNum in numeric) is   
  2. begin   
  3. OPEN p_CURSOR FOR select * from ( select row_.*, rownum rownum_ from (select id,title,status from HYQTEST) row_ where rownum <= higherNum) where rownum_ >lowerNum;   
  4. end TESTC;  

Test with plsql:

 
 
  1. Declare
  2. LowerNum integer;
  3. HigherNum integer;
  4. Id varchar2 (10 );
  5. Title varchar2 (500 );
  6. Status numeric;
  7. C testpackage. Test_CURSOR;
  8. Rownum _ integer;
  9. Begin
  10. LowerNum: = 1;
  11. HigherNum: = 10;
  12. TESTC (c, lowerNum, higherNum );
  13. LOOP
  14. FETCH c INTO id, title, status, rownum _;
  15. Exit when c % NOTFOUND;
  16. DBMS_OUTPUT.PUT_LINE ('= row number =' | rownum _ | '=' | id | '=' | title | '=' | status | '= ');
  17. End loop;
  18. CLOSE c;
  19.  
  20. End;

Three common mistakes in Oracle Database Backup

Oracle RMAN backup Optimization

Learn about Oracle OS backup

Oracle EXP/IMP backup Overview

How to Implement ORACLE backup

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.