Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > Oracle
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Oracle General Oracle database discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Oracle section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old July 1st, 2004, 04:07 AM
Authorized User
Join Date: Apr 2004
Location: malacca, malacca, Malaysia.
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to junemo
Default pagination

Hi, I want craete a page that can list of record in html format. Let say the query may result in hundreds or thousands of records. Then, I need create button PREV and NEXT.

1. Isn't I need to create a procedure and run at SQL* Plus, i.e.

create or replace procedure paginate( p_start in number default 1)
    l_next boolean default false;
    l_pagesize number default 50;
    htp.bold( 'p_start =' || P_start);
    for x in (select *
                   from (select a.*, rownum r from bill a
                   where rownum <= p_start+l_pagesize) a
                   where r >= p_start)
    l_next :=( x.r = p_start=l_pagesize);
    htp.p( '<tr><td>' || x.r || '</td><td>' ||
              x.invno || '</td></tr>');
end loop;
htp.p( '</table>');

if( p_start >1)
    htp.formOpen( 'paginate');
    htp.formHidden( 'p_start', p_start-l_pagesize);
    htp.formSubmit( cvalue => 'prev' || (p_start-l_pagesize));
end if;
    htp.formOpen( 'paginate');
    htp.formHidden( 'p_start', (p_start+l_pagesize));
    htp.formSubmit( cvalue => 'next' || (p_start+l_pagesize));
end if;

Are this code write in correctly? Do have duplicate record?

2. After I have create a procedure, how I want apply this in my application code(PHP)?
$connection = OCILogon("prod", "prod");
$stmt = OCIParse($connection, "SELECT * FROM ( SELECT a.*, rownum rnum
                FROM (SELECT invno FROM bill ORDER BY invno) a
                WHERE rownum < 50)
                WHERE rnum >= 1 ");
$rownum = OCIFetchStatement( $stmt, $results);
//display all entries
          for ( $i=0; $i<$rownum; $i++ )
     echo " <td class=text8Arial11>&nbsp;" .$results["INVNO"][$i]."</td>";
              echo "</tr>";

3. Should I need create a button PREV and NEXT links in <html> tag?i.e.
<a href="javascript:doSubmit_prev();">Previous 50 Records</a>
<a href="javasrcipt:doSubmit_next();">Next 50 Records</a>

Then, where should I POST this form method each time I click the button NEXT / PREV?

Thanks in advance.

Oracle 8.1.7
PHP 4.3.4
Apache / IIS webserver


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pagination with checkboxes argan Pro JSP 2 November 27th, 2008 11:48 PM
Grouping and Pagination jayne XSLT 13 June 6th, 2007 01:52 AM
pagination problem solos XSLT 1 April 4th, 2007 05:40 PM
pagination Regornil Pro JSP 2 May 31st, 2005 06:10 AM
Please.....Pagination junemo PHP Databases 2 September 25th, 2004 01:14 PM

All times are GMT -4. The time now is 01:53 AM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.