In the pl/SQL process, a small case is displayed by page. You can enter the table name, the number of records displayed on each page, the current page, the total number of records returned, and the total number of pages, and the returned result set named www.2cto.com SQL> create or replace package testPackage as type test_cursor (cursor name) is ref cursor (cursor) end testPackage SQL> create procedp8 (table_name in varchar2, -- table name pageSize in number, -- number of records currently displayed pageNow in number, -- current page -- the following content is returned, and the value is assigned to myrows out number during process processing, -- Total number of records myPageCount out number, -- total number of pages p_cursor out testPackage. test_cursor -- returned result set) is -- defines the SQL statement v_ SQL varchar2 (1000); v_begin number: = (pageNow-1) * pageSize + 1; -- the minority v_end number: = pageNow * pageSize displayed on each page; -- the maximum number displayed on each page is www.2cto.com bgein v_ SQL: = 'select * rownum from (SQL> select a1 .*, rownum rn from (select name, sal from '| table_name |') a1 where rownum <= '| v_end |') where rownum> '| v_begi N | ''; open p_cursor for v_ SQL; -- open a cursor and associate it with an SQL statement. v_ SQL: = 'select count (*) from' | table_name ''; -- calculate myrows and myPageCount execute immediate v_ SQL into myrows; -- execute the SQL statement and assign the returned value to myrows to record the total number of records if mod (myrows, pageSize) = 0 then -- calculate the total number of pages. Pay attention to the ideas and understand myPageCount: = myrows/Pagesiez; else myPageCount: = myrows/Pagesiez + 1; end if close p_cursor; -- close the cursor www.2cto.com end ;/--------------------------------- --------------------------------------------------------------------- Class. forName ("oracle. jdbc. driver. oracleDriver "); Connection ct = DriverManager. getConnection ("jdbc: oracle: thin: @ 127.0.0.1: CallableStatement cs = ct. prepareCall ("{call p8 (?,?,?,?,?,?)} "); //? Assign cs. setString (1, "myTable"); SC. setInt (); SC. setInt (); // TO THE out parameter? Assign a value to cs. registOutPrameter (4, oracle. jdbc. oracleTypes. INTEGER); // total number of records on this side cs. registOutPrameter (5, oracle. jdbc. oracleTypes. INTEGER); // The total number of registered pages cs. registOutPrameter (6, oracle. jdbc. oracleTypes. CURSOR); // register the returned result set www.2cto.com // execute cs.exe cute (); // obtain the result set ResultSet rs = (ResultSet) cs. getObject (6); // retrieves the total number of records int rowNum = cs. getInt (4); // The total number of returned pages int pagecount = cs. getInt (5); while (rs. next () {System. out. println (rs. getInt (1) + "--" + rs. getString (2);} // close related resources. The author chunqiuwei is written here.