Pagination help!!!!!!!

Hi all,
Any code for pagination or any refernce to get pagination will be so helpfull
i have a table with 192 records i want to display it 5 records in a page
Please !! could any body help me out??
thanks in advance
bye
Srikavi

Hi Marc,
I agree with you,
but, I have a pl/sql region as
declare
  v_address1    varchar2(4000);
   v_address2   varchar2(4000);
   v_address3   varchar2(4000);
   v_city       varchar2 (400);
   v_place      varchar2(400);
   v_pincode    varchar2(400);
   v_contactname varchar2(400);
   v_fax         varchar2(400);
   v_mobile      varchar2(400);
   v_phone      varchar2(400);
   v_website    varchar2(400);
   v_last_table varchar2(4000);
   v_col_1 varchar2(400);
   v_col_2 varchar2(400);
   v_col_last varchar2(4000);
   v_row_count number;
   v_row_count_1 number;
   n number;
   i number := 1;
   v_sub_table varchar2(4000);
   v_table varchar2(400); v_col varchar2(400); v_col_end varchar2(400);
   v_table_end varchar2(400);v_row varchar2(400);v_row_end varchar2(400);
   v_head varchar2(400);v_head_end varchar2(400);
   l_found varchar2(100) := 'false';
cursor c_emp is (select address1,address2,address3,city,place,pincode, contactname, fax, mobile, phone, website from vw_sub_cl_add1  where (siteid=v('P10_SITENO') and bpcnum_0 = v('P10_CLNO')));
  e_emp c_emp%ROWTYPE;
cursor rec_emp is (select address1,address2,address3,city,place,pincode,siteid,bpcnum_0, contactname,fax,mobile,phone,website from (select address1,address2,address3,city,place,pincode,siteid,bpcnum_0, contactname,fax,mobile,phone,website, row_number() over (partition by contactname, address1  order by contactname, address1) as rn from vw_sub_cl_add1 where siteid=v('P10_SITENO') and bpcnum_0 = v('P10_CLNO')) emp where rn =1);
   r_rec_emp rec_emp%ROWTYPE;
begin
   open c_emp;
   loop
      fetch c_emp into e_emp;
       if c_emp%ROWCOUNT = 0 then
         l_found :=  'true';
       end if; 
      if c_emp%NOTFOUND then
          exit;
      end if;
    end loop;
   close c_emp;
  open rec_emp;
loop
   fetch rec_emp into r_rec_emp;
   exit when rec_emp%NOTFOUND;
   end loop;
v_row_count := rec_emp%ROWCOUNT;
v_row_count_1 := v_row_count - 1;
close rec_emp;
n := round(v_row_count / 2);
v_head := '<th nowrap="nowrap" style="font-size:12px;font-weight:600;font-family:Verdana, Arial, Helvetica, sans-serif;color:white;background-color:#6CAAD9;border-collapse:collapse;border: 1px solid #285577;">';
v_head_end := '</th>';
   v_table := '<table cellpadding="0" cellspacing="0" style="overflow:scroll;empty-cells:show;border:none;">';
v_sub_table := '<table cellpadding="2px" cellspacing="0" style="overflow:scroll;empty-cells:show;border:none" width="350px">';
    v_table_end :='</table>';
    v_col :='<td style="border:none;" nowrap=nowrap>';
    v_col_1 := '<td style="border-bottom:1px solid #DFDFDF;border-right:1px solid #DFDFDF; padding:10px 10px 10px 0;" nowrap=nowrap valign="top">';
        v_col_last := '<td style="border-right:1px solid #DFDFDF; padding:10px 10px 10px 0;" valign="top" nowrap=nowrap>';
    v_col_2 := '<td valign="top" style="border-bottom:1px solid #DFDFDF; padding:10px 0px 10px 10px;" nowrap=nowrap>';
    v_col_end := '</td>';
   v_row := '<tr>';
   v_row_end := '</tr>';
if l_found = 'false' then
     htp.p(v_table);
    for subadd_rec in  rec_emp loop
     v_address1 :=  subadd_rec.address1;
     v_address2 :=  subadd_rec.address2;
     v_address3 :=  subadd_rec.address3;
     v_place    :=  subadd_rec.place;
     v_city     :=  subadd_rec.city;
     v_pincode  :=  subadd_rec.pincode;
     v_contactname := subadd_rec.contactname;
     v_fax      :=  subadd_rec.fax;
     v_mobile   :=  subadd_rec.mobile;
     v_phone    :=  subadd_rec.phone;
     v_website  :=  subadd_rec.website;
    if ((mod(rec_emp%ROWCOUNT,2) != 0) and (rec_emp%ROWCOUNT != v_row_count) and (rec_emp%ROWCOUNT != v_row_count_1)) then
     htp.p(v_row||v_col_1);
     HTP.p(v_sub_table);
      HTP.p (v_row||v_col|| v_contactname || v_col_end||v_row_end);
      HTP.p (v_row||v_col|| v_address1 ||', ');
      if (v_address2 != '-NA-') then
       HTP.p(v_address2 ||', ');
      elsif (v_address3 != '-NA-') then
        HTP.p(v_address3 || v_col_end||v_row_end);
      end if;
      HTP.p(v_row|| v_col || v_city || v_col_end||v_row_end);
      HTP.p(v_row|| v_col || v_place || v_col_end||v_row_end);
      HTP.p(v_row|| v_col || v_pincode || v_col_end ||v_row_end);
      if (v_phone != '-NA-') then
      HTP.p(v_row||v_col||'Phone:'|| v_phone || v_col_end ||v_row_end);
      end if;
      if (v_fax != '-NA-') then
      HTP.p(v_row||v_col||'Fax:'|| v_fax || v_col_end ||v_row_end);
      end if;
       if (v_mobile != '-NA-') then
      HTP.p(v_row||v_col||'Mobile:'|| v_mobile ||  v_col_end ||v_row_end);
      end if;
      if (v_website != '-NA-') then
      HTP.p(v_row||v_col||'Website:'|| v_website ||  v_col_end ||v_row_end);
      end if;
      htp.p(v_table_end);
      htp.p(v_col_end);
      elsif (mod(rec_emp%ROWCOUNT,2) != 0) and (rec_emp%ROWCOUNT = (v_row_count)) then
       htp.p(v_row||v_col_last);
       HTP.p(v_sub_table);
      HTP.p (v_row||v_col|| v_contactname || v_col_end||v_row_end);
      HTP.p (v_row||v_col|| v_address1 ||', ');
      if (v_address2 != '-NA-') then
       HTP.p(v_address2 ||', ');
      elsif (v_address3 != '-NA-') then
        HTP.p(v_address3 || v_col_end||v_row_end);
      end if;
      HTP.p(v_row|| v_col || v_city || v_col_end||v_row_end);
      HTP.p(v_row|| v_col || v_place || v_col_end||v_row_end);
      HTP.p(v_row|| v_col || v_pincode || v_col_end ||v_row_end);
      if (v_phone != '-NA-') then
      HTP.p(v_row||v_col||'Phone:'|| v_phone || v_col_end ||v_row_end);
      end if;
      if (v_fax != '-NA-') then
      HTP.p(v_row||v_col||'Fax:'|| v_fax || v_col_end ||v_row_end);
      end if;
       if (v_mobile != '-NA-') then
      HTP.p(v_row||v_col||'Mobile:'|| v_mobile ||  v_col_end ||v_row_end);
      end if;
      if (v_website != '-NA-') then
      HTP.p(v_row||v_col||'Website:'|| v_website ||  v_col_end ||v_row_end);
      end if;
      htp.p(v_table_end);
      htp.p(v_col_end);
    elsif(mod(rec_emp%ROWCOUNT,2) != 0) and (rec_emp%ROWCOUNT = v_row_count_1)   then
       htp.p(v_row||v_col_last);
       HTP.p(v_sub_table);
      HTP.p (v_row||v_col|| v_contactname || v_col_end||v_row_end);
      HTP.p (v_row||v_col|| v_address1 ||', ');
      if (v_address2 != '-NA-') then
       HTP.p(v_address2 ||', ');
      elsif (v_address3 != '-NA-') then
        HTP.p(v_address3 || v_col_end||v_row_end);
      end if;
      HTP.p(v_row|| v_col || v_city || v_col_end||v_row_end);
      HTP.p(v_row|| v_col || v_place || v_col_end||v_row_end);
      HTP.p(v_row|| v_col || v_pincode || v_col_end ||v_row_end);
      if (v_phone != '-NA-') then
      HTP.p(v_row||v_col||'Phone:'|| v_phone || v_col_end ||v_row_end);
      end if;
      if (v_fax != '-NA-') then
      HTP.p(v_row||v_col||'Fax:'|| v_fax || v_col_end ||v_row_end);
      end if;
       if (v_mobile != '-NA-') then
      HTP.p(v_row||v_col||'Mobile:'|| v_mobile ||  v_col_end ||v_row_end);
      end if;
      if (v_website != '-NA-') then
      HTP.p(v_row||v_col||'Website:'|| v_website ||  v_col_end ||v_row_end);
      end if;
      htp.p(v_table_end);
      htp.p(v_col_end);
      end if;
     if (mod(rec_emp%ROWCOUNT,2) = 0) and (rec_emp%ROWCOUNT != (v_row_count )) then
      htp.p(v_col_2);
      HTP.p(v_sub_table);
      HTP.p (v_row||v_col|| v_contactname || v_col_end||v_row_end);
      HTP.p (v_row||v_col|| v_address1 ||', ');
      if (v_address2 != '-NA-') then
       HTP.p(v_address2 ||', ');
      elsif (v_address3 != '-NA-') then
        HTP.p(v_address3 || v_col_end||v_row_end);
      end if;
      HTP.p(v_row|| v_col || v_city || v_col_end||v_row_end);
      HTP.p(v_row|| v_col || v_place || v_col_end||v_row_end);
      HTP.p(v_row|| v_col || v_pincode || v_col_end ||v_row_end);
      if (v_phone != '-NA-') then
      HTP.p(v_row||v_col||'Phone:'|| v_phone || v_col_end ||v_row_end);
      end if;
      if (v_fax != '-NA-') then
      HTP.p(v_row||v_col||'Fax:'|| v_fax || v_col_end ||v_row_end);
      end if;
       if (v_mobile != '-NA-') then
      HTP.p(v_row||v_col||'Mobile:'|| v_mobile ||  v_col_end ||v_row_end);
      end if;
      if (v_website != '-NA-') then
      HTP.p(v_row||v_col||'Website:'|| v_website ||  v_col_end ||v_row_end);
      end if;
      htp.p(v_table_end);
      elsif (mod(rec_emp%ROWCOUNT,2) = 0) and (rec_emp%ROWCOUNT = (v_row_count )) then
       htp.p(v_col);
       HTP.p(v_sub_table);
      HTP.p (v_row||v_col|| v_contactname || v_col_end||v_row_end);
      HTP.p (v_row||v_col|| v_address1 ||', ');
      if (v_address2 != '-NA-') then
       HTP.p(v_address2 ||', ');
      elsif (v_address3 != '-NA-') then
        HTP.p(v_address3 || v_col_end||v_row_end);
      end if;
      HTP.p(v_row|| v_col || v_city || v_col_end||v_row_end);
      HTP.p(v_row|| v_col || v_place || v_col_end||v_row_end);
      HTP.p(v_row|| v_col || v_pincode || v_col_end ||v_row_end);
      if (v_phone != '-NA-') then
      HTP.p(v_row||v_col||'Phone:'|| v_phone || v_col_end ||v_row_end);
      end if;
      if (v_fax != '-NA-') then
      HTP.p(v_row||v_col||'Fax:'|| v_fax || v_col_end ||v_row_end);
      end if;
       if (v_mobile != '-NA-') then
      HTP.p(v_row||v_col||'Mobile:'|| v_mobile ||  v_col_end ||v_row_end);
      end if;
      if (v_website != '-NA-') then
      HTP.p(v_row||v_col||'Website:'|| v_website ||  v_col_end ||v_row_end);
      end if;
      htp.p(v_table_end);
      end if;
      htp.p(v_col_end);
    end loop;
htp.p(v_table_end); 
else
htp.p( '<p style="font-size:14px;font-weight:500;font-family:Verdana, Arial, Helvetica, sans-serif;color:black;width:400px;margin-top:20px;" align="left">Contact(s) Not Available </p>');
end if;
end;For eg: if the total records are 50 i need to display in 5 pages with each page 10 records
for which i need manual coding for pagination
thanks in advance
bye
Srikavi

Similar Messages

  • XML pagination help

    I would like to use one single query to get all the data from a database.
    which would in turn be in an xml file. I would like to display this xml file with more than 100 entries by applying pagination. so that say I could display 10 entries per page.
    Could any one suggest a method for doing this.

    Anyway, assuming you are using 10g, here you go:
    I am sure you can do it using table(xmlsequence(extract))) construct, but, XMLTable is recommended if it exists.
    RAHUL@d > col name for a10
    RAHUL@d > col dept for a10
    RAHUL@d > col workphone for a12
    RAHUL@d > col cellphone for a12
    RAHUL@d > col homephone for a12
    RAHUL@d > select n1 name, n2 dept, n3 workphone, n4 homephone, n5 cellphone
      2    from xmltbl t,
      3         xmltable('Emp' passing value(t) columns n1 varchar2(32) path
      4                  '/Emp/Ename',
      5                  n2 varchar2(32) path '/Emp/dept',
      6                  n3 varchar2(32) path '/Emp/phones/workphone',
      7                  n4 varchar2(32) path '/Emp/phones/homephone',
      8                  n5 varchar2(32) path '/Emp/phones/cellphone')
      9  /
    NAME       DEPT       WORKPHONE    HOMEPHONE    CELLPHONE
    John       orange     5552221212   5551112222   4442223333
    Mary       orange     5552221212   5551112222
    Bill       blue
    Elapsed: 00:00:00.06
    RAHUL@d > disc
    Disconnected from Oracle Database 10g Release 10.2.0.1.0 - Productionedit: showed the version too.
    Message was edited by:
    RPuttagunta

  • PHP Pagination Help

    I'm php newbie and I"m trying to create pagination for some DP results and I'm having some problems. I can view the pagination at the bottom of my DB results, however when I click on the numbers I remain on the same page.  I'm using this 7 step pagination script: http://www.phpeasystep.com/phptu/29.html and I think my problem may be within step 7, im confused on what to do for that step, but it could be something else. I don't deal with code that often so this new to me. So my question is how do I get this script to work?
    HERES MY CODE:
    <?php require_once('Connections/myconnectboi.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $currentPage = $_SERVER["PHP_SELF"];
    $maxRows_Recordset2 = 4;
    $pageNum_Recordset2 = 0;
    if (isset($_GET['pageNum_Recordset2'])) {
      $pageNum_Recordset2 = $_GET['pageNum_Recordset2'];
    $startRow_Recordset2 = $pageNum_Recordset2 * $maxRows_Recordset2;
    mysql_select_db($database_myconnectboi, $myconnectboi);
    $query_Recordset2 = "SELECT * FROM hiphop ORDER BY id DESC";
    $query_limit_Recordset2 = sprintf("%s LIMIT %d, %d", $query_Recordset2, $startRow_Recordset2, $maxRows_Recordset2);
    $Recordset2 = mysql_query($query_limit_Recordset2, $myconnectboi) or die(mysql_error());
    $row_Recordset2 = mysql_fetch_assoc($Recordset2);
    if (isset($_GET['totalRows_Recordset2'])) {
      $totalRows_Recordset2 = $_GET['totalRows_Recordset2'];
    } else {
      $all_Recordset2 = mysql_query($query_Recordset2);
      $totalRows_Recordset2 = mysql_num_rows($all_Recordset2);
    $totalPages_Recordset2 = ceil($totalRows_Recordset2/$maxRows_Recordset2)-1;
    $queryString_Recordset2 = "";
    if (!empty($_SERVER['QUERY_STRING'])) {
      $params = explode("&", $_SERVER['QUERY_STRING']);
      $newParams = array();
      foreach ($params as $param) {
        if (stristr($param, "pageNum_Recordset2") == false &&
            stristr($param, "totalRows_Recordset2") == false) {
          array_push($newParams, $param);
      if (count($newParams) != 0) {
        $queryString_Recordset2 = "&" . htmlentities(implode("&", $newParams));
    $queryString_Recordset2 = sprintf("&totalRows_Recordset2=%d%s", $totalRows_Recordset2, $queryString_Recordset2);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>
    <table cellspacing="0">
      <tr>
        <td width="300"></td>
        <td></td>
        <td width="14"></td>
        <td width="0"></td>
      </tr>
      <?php do { ?>
        <tr>
          <td height="32" colspan="2" bgcolor="#3399CC"><?php echo $row_Recordset2['description']; ?></td>
        </tr>
        <tr>
          <td><img src="<?php echo $row_Recordset2['image']; ?>" width="300" height="250" border="5" /></td>
          <td width="300" height="250" align="center" bgcolor="#FFFFFF"><?php echo $row_Recordset2['description']; ?></td>
        </tr>
        <?php } while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)); ?>
    </table>
    <p>
      <?php
            Place code to connect to your DB here.
        include('Connections/myconnectboi.php');    // include your code to connect to DB.
        $tbl_name="hiphop";        //your table name
        // How many adjacent pages should be shown on each side?
        $adjacents = 3;
           First get total number of rows in data table.
           If you have a WHERE clause in your query, make sure you mirror it here.
        $query = "SELECT COUNT(*) as num FROM $tbl_name";
        $total_pages = mysql_fetch_array(mysql_query($query));
        $total_pages = $total_pages['num'];
        /* Setup vars for query. */
        $targetpage = "test.php";     //your file name  (the name of this file)
        $limit = 4;                                 //how many items to show per page
        $page = $_GET['page'];
        if($page)
            $start = ($page - 1) * $limit;             //first item to display on this page
        else
            $start = 0;                                //if no page var is given, set start to 0
        /* Get data. */
        $sql = "SELECT id FROM $tbl_name LIMIT $start, $limit";
        $result = mysql_query($sql);
        /* Setup page vars for display. */
        if ($page == 0) $page = 1;                    //if no page var is given, default to 1.
        $prev = $page - 1;                            //previous page is page - 1
        $next = $page + 1;                            //next page is page + 1
        $lastpage = ceil($total_pages/$limit);        //lastpage is = total pages / items per page, rounded up.
        $lpm1 = $lastpage - 1;                        //last page minus 1
            Now we apply our rules and draw the pagination object.
            We're actually saving the code to a variable in case we want to draw it more than once.
        $pagination = "";
        if($lastpage > 1)
            $pagination .= "<div class=\"pagination\">";
            //previous button
            if ($page > 1)
                $pagination.= "<a href=\"$targetpage?page=$prev\">« previous</a>";
            else
                $pagination.= "<span class=\"disabled\">« previous</span>";   
            //pages   
            if ($lastpage < 7 + ($adjacents * 2))    //not enough pages to bother breaking it up
                for ($counter = 1; $counter <= $lastpage; $counter++)
                    if ($counter == $page)
                        $pagination.= "<span class=\"current\">$counter</span>";
                    else
                        $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";                   
            elseif($lastpage > 5 + ($adjacents * 2))    //enough pages to hide some
                //close to beginning; only hide later pages
                if($page < 1 + ($adjacents * 2))       
                    for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
                        if ($counter == $page)
                            $pagination.= "<span class=\"current\">$counter</span>";
                        else
                            $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";                   
                    $pagination.= "...";
                    $pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>";
                    $pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>";       
                //in middle; hide some front and some back
                elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
                    $pagination.= "<a href=\"$targetpage?page=1\">1</a>";
                    $pagination.= "<a href=\"$targetpage?page=2\">2</a>";
                    $pagination.= "...";
                    for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
                        if ($counter == $page)
                            $pagination.= "<span class=\"current\">$counter</span>";
                        else
                            $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";                   
                    $pagination.= "...";
                    $pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>";
                    $pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>";       
                //close to end; only hide early pages
                else
                    $pagination.= "<a href=\"$targetpage?page=1\">1</a>";
                    $pagination.= "<a href=\"$targetpage?page=2\">2</a>";
                    $pagination.= "...";
                    for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
                        if ($counter == $page)
                            $pagination.= "<span class=\"current\">$counter</span>";
                        else
                            $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";                   
            //next button
            if ($page < $counter - 1)
                $pagination.= "<a href=\"$targetpage?page=$next\">next »</a>";
            else
                $pagination.= "<span class=\"disabled\">next »</span>";
            $pagination.= "</div>\n";       
    ?>
      <?php
            while($row = mysql_fetch_array($result))
            // Show if not last page
        ?>
      <?=$pagination?> 
    </p>
    <p> </p>
    <p> </p>
    <p> </p>
    </body>
    </html>
    <?php
    mysql_free_result($Recordset2);
    ?>

    I'm php newbie and I"m trying to create pagination for some DP results and I'm having some problems. I can view the pagination at the bottom of my DB results, however when I click on the numbers I remain on the same page.  I'm using this 7 step pagination script: http://www.phpeasystep.com/phptu/29.html and I think my problem may be within step 7, im confused on what to do for that step, but it could be something else. I don't deal with code that often so this new to me. So my question is how do I get this script to work?
    HERES MY CODE:
    <?php require_once('Connections/myconnectboi.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $currentPage = $_SERVER["PHP_SELF"];
    $maxRows_Recordset2 = 4;
    $pageNum_Recordset2 = 0;
    if (isset($_GET['pageNum_Recordset2'])) {
      $pageNum_Recordset2 = $_GET['pageNum_Recordset2'];
    $startRow_Recordset2 = $pageNum_Recordset2 * $maxRows_Recordset2;
    mysql_select_db($database_myconnectboi, $myconnectboi);
    $query_Recordset2 = "SELECT * FROM hiphop ORDER BY id DESC";
    $query_limit_Recordset2 = sprintf("%s LIMIT %d, %d", $query_Recordset2, $startRow_Recordset2, $maxRows_Recordset2);
    $Recordset2 = mysql_query($query_limit_Recordset2, $myconnectboi) or die(mysql_error());
    $row_Recordset2 = mysql_fetch_assoc($Recordset2);
    if (isset($_GET['totalRows_Recordset2'])) {
      $totalRows_Recordset2 = $_GET['totalRows_Recordset2'];
    } else {
      $all_Recordset2 = mysql_query($query_Recordset2);
      $totalRows_Recordset2 = mysql_num_rows($all_Recordset2);
    $totalPages_Recordset2 = ceil($totalRows_Recordset2/$maxRows_Recordset2)-1;
    $queryString_Recordset2 = "";
    if (!empty($_SERVER['QUERY_STRING'])) {
      $params = explode("&", $_SERVER['QUERY_STRING']);
      $newParams = array();
      foreach ($params as $param) {
        if (stristr($param, "pageNum_Recordset2") == false &&
            stristr($param, "totalRows_Recordset2") == false) {
          array_push($newParams, $param);
      if (count($newParams) != 0) {
        $queryString_Recordset2 = "&" . htmlentities(implode("&", $newParams));
    $queryString_Recordset2 = sprintf("&totalRows_Recordset2=%d%s", $totalRows_Recordset2, $queryString_Recordset2);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>
    <table cellspacing="0">
      <tr>
        <td width="300"></td>
        <td></td>
        <td width="14"></td>
        <td width="0"></td>
      </tr>
      <?php do { ?>
        <tr>
          <td height="32" colspan="2" bgcolor="#3399CC"><?php echo $row_Recordset2['description']; ?></td>
        </tr>
        <tr>
          <td><img src="<?php echo $row_Recordset2['image']; ?>" width="300" height="250" border="5" /></td>
          <td width="300" height="250" align="center" bgcolor="#FFFFFF"><?php echo $row_Recordset2['description']; ?></td>
        </tr>
        <?php } while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)); ?>
    </table>
    <p>
      <?php
            Place code to connect to your DB here.
        include('Connections/myconnectboi.php');    // include your code to connect to DB.
        $tbl_name="hiphop";        //your table name
        // How many adjacent pages should be shown on each side?
        $adjacents = 3;
           First get total number of rows in data table.
           If you have a WHERE clause in your query, make sure you mirror it here.
        $query = "SELECT COUNT(*) as num FROM $tbl_name";
        $total_pages = mysql_fetch_array(mysql_query($query));
        $total_pages = $total_pages['num'];
        /* Setup vars for query. */
        $targetpage = "test.php";     //your file name  (the name of this file)
        $limit = 4;                                 //how many items to show per page
        $page = $_GET['page'];
        if($page)
            $start = ($page - 1) * $limit;             //first item to display on this page
        else
            $start = 0;                                //if no page var is given, set start to 0
        /* Get data. */
        $sql = "SELECT id FROM $tbl_name LIMIT $start, $limit";
        $result = mysql_query($sql);
        /* Setup page vars for display. */
        if ($page == 0) $page = 1;                    //if no page var is given, default to 1.
        $prev = $page - 1;                            //previous page is page - 1
        $next = $page + 1;                            //next page is page + 1
        $lastpage = ceil($total_pages/$limit);        //lastpage is = total pages / items per page, rounded up.
        $lpm1 = $lastpage - 1;                        //last page minus 1
            Now we apply our rules and draw the pagination object.
            We're actually saving the code to a variable in case we want to draw it more than once.
        $pagination = "";
        if($lastpage > 1)
            $pagination .= "<div class=\"pagination\">";
            //previous button
            if ($page > 1)
                $pagination.= "<a href=\"$targetpage?page=$prev\">« previous</a>";
            else
                $pagination.= "<span class=\"disabled\">« previous</span>";   
            //pages   
            if ($lastpage < 7 + ($adjacents * 2))    //not enough pages to bother breaking it up
                for ($counter = 1; $counter <= $lastpage; $counter++)
                    if ($counter == $page)
                        $pagination.= "<span class=\"current\">$counter</span>";
                    else
                        $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";                   
            elseif($lastpage > 5 + ($adjacents * 2))    //enough pages to hide some
                //close to beginning; only hide later pages
                if($page < 1 + ($adjacents * 2))       
                    for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
                        if ($counter == $page)
                            $pagination.= "<span class=\"current\">$counter</span>";
                        else
                            $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";                   
                    $pagination.= "...";
                    $pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>";
                    $pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>";       
                //in middle; hide some front and some back
                elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
                    $pagination.= "<a href=\"$targetpage?page=1\">1</a>";
                    $pagination.= "<a href=\"$targetpage?page=2\">2</a>";
                    $pagination.= "...";
                    for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
                        if ($counter == $page)
                            $pagination.= "<span class=\"current\">$counter</span>";
                        else
                            $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";                   
                    $pagination.= "...";
                    $pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>";
                    $pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>";       
                //close to end; only hide early pages
                else
                    $pagination.= "<a href=\"$targetpage?page=1\">1</a>";
                    $pagination.= "<a href=\"$targetpage?page=2\">2</a>";
                    $pagination.= "...";
                    for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
                        if ($counter == $page)
                            $pagination.= "<span class=\"current\">$counter</span>";
                        else
                            $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";                   
            //next button
            if ($page < $counter - 1)
                $pagination.= "<a href=\"$targetpage?page=$next\">next »</a>";
            else
                $pagination.= "<span class=\"disabled\">next »</span>";
            $pagination.= "</div>\n";       
    ?>
      <?php
            while($row = mysql_fetch_array($result))
            // Show if not last page
        ?>
      <?=$pagination?> 
    </p>
    <p> </p>
    <p> </p>
    <p> </p>
    </body>
    </html>
    <?php
    mysql_free_result($Recordset2);
    ?>

  • Problemas para comprar la In design CS5

    Mi version de prueba esta caducada, y al intentar comprarla solo me da ls opciones CS6 y CC que no son compatibles con mi mac ox 10.05.08.
    Que puedo hacer??
    Ya he hecho la compra y ahora no encuentro el programa justo que bajar!!!
    Es urgente el tema, tengo que entreagr hoy un archivo de 200 paginas   HELP!

    Bonjour, cette première image montre la bonne façon :
    Et celle-ci montre comment l'information chevauche les repères :
    Merci de vous pencher sur ce problème.

  • Pagination query help needed for large table - force a different index

    I'm using a slight modification of the pagination query from over at Ask Tom's: [http://www.oracle.com/technology/oramag/oracle/07-jan/o17asktom.html]
    Mine looks like this when fetching the first 100 rows of all members with last name Smith, ordered by join date:
    SELECT members.*
    FROM members,
        SELECT RID, rownum rnum
        FROM
            SELECT rowid as RID
            FROM members
            WHERE last_name = 'Smith'
            ORDER BY joindate
        WHERE rownum <= 100
    WHERE rnum >= 1
             and RID = members.rowidThe difference between this and the one at Ask Tom's is that my innermost query just returns the ROWID. Then in the outermost query we join the ROWIDs returned to the members table, after we have pruned the ROWIDs down to only the chunk of 100 we want. This makes it MUCH faster (verifiably) on our large tables, as it is able to use the index on the innermost query (well... read on).
    The problem I have is this:
    SELECT rowid as RID
    FROM members
    WHERE last_name = 'Smith'
    ORDER BY joindateThis will use the index for the predicate column (last_name) instead of the unique index I have defined for the joindate column (joindate, sequence). (Verifiable with explain plan). It is much slower this way on a large table. So I can hint it using either of the following methods:
    SELECT /*+ index(members, joindate_idx) */ rowid as RID
    FROM members
    WHERE last_name = 'Smith'
    ORDER BY joindate
    SELECT /*+ first_rows(100) */ rowid as RID
    FROM members
    WHERE last_name = 'Smith'
    ORDER BY joindateEither way, it now uses the index of the ORDER BY column (joindate_idx), so now it is much faster as it does not have to do a sort (remember, VERY large table, millions of records). So that seems good. But now, on my outermost query, I join the rowid with the meaningful columns of data from the members table, as commented below:
    SELECT members.*      -- Select all data from members table
    FROM members,           -- members table added to FROM clause
        SELECT RID, rownum rnum
        FROM
            SELECT /*+ index(members, joindate_idx) */ rowid as RID   -- Hint is ignored now that I am joining in the outer query
            FROM members
            WHERE last_name = 'Smith'
            ORDER BY joindate
        WHERE rownum <= 100
    WHERE rnum >= 1
            and RID = members.rowid           -- Merge the members table on the rowid we pulled from the inner queriesOnce I do this join, it goes back to using the predicate index (last_name) and has to perform the sort once it finds all matching values (which can be a lot in this table, there is high cardinality on some columns).
    So my question is, in the full query above, is there any way I can get it to use the ORDER BY column for indexing to prevent it from having to do a sort? The join is what causes it to revert back to using the predicate index, even with hints. Remove the join and just return the ROWIDs for those 100 records and it flies, even on 10 million records.
    It'd be great if there was some generic hint that could accomplish this, such that if we change the table/columns/indexes, we don't need to change the hint (the FIRST_ROWS hint is a good example of this, while the INDEX hint is the opposite), but any help would be appreciated. I can provide explain plans for any of the above if needed.
    Thanks!

    Lakmal Rajapakse wrote:
    OK here is an example to illustrate the advantage:
    SQL> set autot traceonly
    SQL> select * from (
    2  select a.*, rownum x  from
    3  (
    4  select a.* from aoswf.events a
    5  order by EVENT_DATETIME
    6  ) a
    7  where rownum <= 1200
    8  )
    9  where x >= 1100
    10  /
    101 rows selected.
    Execution Plan
    Plan hash value: 3711662397
    | Id  | Operation                      | Name       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT               |            |  1200 |   521K|   192   (0)| 00:00:03 |
    |*  1 |  VIEW                          |            |  1200 |   521K|   192   (0)| 00:00:03 |
    |*  2 |   COUNT STOPKEY                |            |       |       |            |          |
    |   3 |    VIEW                        |            |  1200 |   506K|   192   (0)| 00:00:03 |
    |   4 |     TABLE ACCESS BY INDEX ROWID| EVENTS     |   253M|    34G|   192   (0)| 00:00:03 |
    |   5 |      INDEX FULL SCAN           | EVEN_IDX02 |  1200 |       |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    1 - filter("X">=1100)
    2 - filter(ROWNUM<=1200)
    Statistics
    0  recursive calls
    0  db block gets
    443  consistent gets
    0  physical reads
    0  redo size
    25203  bytes sent via SQL*Net to client
    281  bytes received via SQL*Net from client
    8  SQL*Net roundtrips to/from client
    0  sorts (memory)
    0  sorts (disk)
    101  rows processed
    SQL>
    SQL>
    SQL> select * from aoswf.events a, (
    2  select rid, rownum x  from
    3  (
    4  select rowid rid from aoswf.events a
    5  order by EVENT_DATETIME
    6  ) a
    7  where rownum <= 1200
    8  ) b
    9  where x >= 1100
    10  and a.rowid = rid
    11  /
    101 rows selected.
    Execution Plan
    Plan hash value: 2308864810
    | Id  | Operation                   | Name       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |            |  1200 |   201K|   261K  (1)| 00:52:21 |
    |   1 |  NESTED LOOPS               |            |  1200 |   201K|   261K  (1)| 00:52:21 |
    |*  2 |   VIEW                      |            |  1200 | 30000 |   260K  (1)| 00:52:06 |
    |*  3 |    COUNT STOPKEY            |            |       |       |            |          |
    |   4 |     VIEW                    |            |   253M|  2895M|   260K  (1)| 00:52:06 |
    |   5 |      INDEX FULL SCAN        | EVEN_IDX02 |   253M|  4826M|   260K  (1)| 00:52:06 |
    |   6 |   TABLE ACCESS BY USER ROWID| EVENTS     |     1 |   147 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - filter("X">=1100)
    3 - filter(ROWNUM<=1200)
    Statistics
    8  recursive calls
    0  db block gets
    117  consistent gets
    0  physical reads
    0  redo size
    27539  bytes sent via SQL*Net to client
    281  bytes received via SQL*Net from client
    8  SQL*Net roundtrips to/from client
    0  sorts (memory)
    0  sorts (disk)
    101  rows processed
    Lakmal (and OP),
    Not sure what advantage you are trying to show here. But considering that we are talking about pagination query here and order of records is important, your 2 queries will not always generate output in same order. Here is the test case:
    SQL> select * from v$version ;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE     10.2.0.1.0     Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    SQL> show parameter optimizer
    NAME                                 TYPE        VALUE
    optimizer_dynamic_sampling           integer     2
    optimizer_features_enable            string      10.2.0.1
    optimizer_index_caching              integer     0
    optimizer_index_cost_adj             integer     100
    optimizer_mode                       string      ALL_ROWS
    optimizer_secure_view_merging        boolean     TRUE
    SQL> show parameter pga
    NAME                                 TYPE        VALUE
    pga_aggregate_target                 big integer 103M
    SQL> create table t nologging as select * from all_objects where 1 = 2 ;
    Table created.
    SQL> create index t_idx on t(last_ddl_time) nologging ;
    Index created.
    SQL> insert /*+ APPEND */ into t (owner, object_name, object_id, created, last_ddl_time) select owner, object_name, object_id, created, sysdate - dbms_random.value(1, 100) from all_objects order by dbms_random.random;
    40617 rows created.
    SQL> commit ;
    Commit complete.
    SQL> exec dbms_stats.gather_table_stats(user, 'T', cascade=>true);
    PL/SQL procedure successfully completed.
    SQL> select object_id, object_name, created from t, (select rid, rownum rn from (select rowid rid from t order by created desc) where rownum <= 1200) t1 where rn >= 1190 and t.rowid = t1.rid ;
    OBJECT_ID OBJECT_NAME                    CREATED
         47686 ALL$OLAP2_JOIN_KEY_COLUMN_USES 28-JUL-2009 08:08:39
         47672 ALL$OLAP2_CUBE_DIM_USES        28-JUL-2009 08:08:39
         47681 ALL$OLAP2_CUBE_MEASURE_MAPS    28-JUL-2009 08:08:39
         47682 ALL$OLAP2_FACT_LEVEL_USES      28-JUL-2009 08:08:39
         47685 ALL$OLAP2_AGGREGATION_USES     28-JUL-2009 08:08:39
         47692 ALL$OLAP2_CATALOGS             28-JUL-2009 08:08:39
         47665 ALL$OLAPMR_FACTTBLKEYMAPS      28-JUL-2009 08:08:39
         47688 ALL$OLAP2_DIM_LEVEL_ATTR_MAPS  28-JUL-2009 08:08:39
         47689 ALL$OLAP2_DIM_LEVELS_KEYMAPS   28-JUL-2009 08:08:39
         47669 ALL$OLAP9I2_HIER_DIMENSIONS    28-JUL-2009 08:08:39
         47666 ALL$OLAP9I1_HIER_DIMENSIONS    28-JUL-2009 08:08:39
    11 rows selected.
    SQL> select object_id, object_name, last_ddl_time from t, (select rid, rownum rn from (select rowid rid from t order by last_ddl_time desc) where rownum <= 1200) t1 where rn >= 1190 and t.rowid = t1.rid ;
    OBJECT_ID OBJECT_NAME                    LAST_DDL_TIME
         11749 /b9fe5b99_OraRTStatementComman 06-FEB-2010 03:43:49
         13133 oracle/jdbc/driver/OracleLog$3 06-FEB-2010 03:45:44
         37534 com/sun/mail/smtp/SMTPMessage  06-FEB-2010 03:46:14
         36145 /4e492b6f_SerProfileToClassErr 06-FEB-2010 03:11:09
         26815 /7a628fb8_DefaultHSBChooserPan 06-FEB-2010 03:26:55
         16695 /2940a364_RepIdDelegator_1_3   06-FEB-2010 03:38:17
         36539 sun/io/ByteToCharMacHebrew     06-FEB-2010 03:28:57
         14044 /d29b81e1_OldHeaders           06-FEB-2010 03:12:12
         12920 /25f8f3a5_BasicSplitPaneUI     06-FEB-2010 03:11:06
         42266 SI_GETCLRHSTGRFTR              06-FEB-2010 03:40:20
         15752 /2f494dce_JDWPThreadReference  06-FEB-2010 03:09:31
    11 rows selected.
    SQL> select object_id, object_name, last_ddl_time from (select t1.*, rownum rn from (select * from t order by last_ddl_time desc) t1 where rownum <= 1200) where rn >= 1190 ;
    OBJECT_ID OBJECT_NAME                    LAST_DDL_TIME
         37534 com/sun/mail/smtp/SMTPMessage  06-FEB-2010 03:46:14
         13133 oracle/jdbc/driver/OracleLog$3 06-FEB-2010 03:45:44
         11749 /b9fe5b99_OraRTStatementComman 06-FEB-2010 03:43:49
         42266 SI_GETCLRHSTGRFTR              06-FEB-2010 03:40:20
         16695 /2940a364_RepIdDelegator_1_3   06-FEB-2010 03:38:17
         36539 sun/io/ByteToCharMacHebrew     06-FEB-2010 03:28:57
         26815 /7a628fb8_DefaultHSBChooserPan 06-FEB-2010 03:26:55
         14044 /d29b81e1_OldHeaders           06-FEB-2010 03:12:12
         36145 /4e492b6f_SerProfileToClassErr 06-FEB-2010 03:11:09
         12920 /25f8f3a5_BasicSplitPaneUI     06-FEB-2010 03:11:06
         15752 /2f494dce_JDWPThreadReference  06-FEB-2010 03:09:31
    11 rows selected.
    SQL> select object_id, object_name, last_ddl_time from t, (select rid, rownum rn from (select rowid rid from t order by last_ddl_time desc) where rownum <= 1200) t1 where rn >= 1190 and t.rowid = t1.rid order by last_ddl_time desc ;
    OBJECT_ID OBJECT_NAME                    LAST_DDL_TIME
         37534 com/sun/mail/smtp/SMTPMessage  06-FEB-2010 03:46:14
         13133 oracle/jdbc/driver/OracleLog$3 06-FEB-2010 03:45:44
         11749 /b9fe5b99_OraRTStatementComman 06-FEB-2010 03:43:49
         42266 SI_GETCLRHSTGRFTR              06-FEB-2010 03:40:20
         16695 /2940a364_RepIdDelegator_1_3   06-FEB-2010 03:38:17
         36539 sun/io/ByteToCharMacHebrew     06-FEB-2010 03:28:57
         26815 /7a628fb8_DefaultHSBChooserPan 06-FEB-2010 03:26:55
         14044 /d29b81e1_OldHeaders           06-FEB-2010 03:12:12
         36145 /4e492b6f_SerProfileToClassErr 06-FEB-2010 03:11:09
         12920 /25f8f3a5_BasicSplitPaneUI     06-FEB-2010 03:11:06
         15752 /2f494dce_JDWPThreadReference  06-FEB-2010 03:09:31
    11 rows selected.
    SQL> set autotrace traceonly
    SQL> select object_id, object_name, last_ddl_time from t, (select rid, rownum rn from (select rowid rid from t order by last_ddl_time desc) where rownum <= 1200) t1 where rn >= 1190 and t.rowid = t1.rid order by last_ddl_time desc
      2  ;
    11 rows selected.
    Execution Plan
    Plan hash value: 44968669
    | Id  | Operation                       | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                |       |  1200 | 91200 |   180   (2)| 00:00:03 |
    |   1 |  SORT ORDER BY                  |       |  1200 | 91200 |   180   (2)| 00:00:03 |
    |*  2 |   HASH JOIN                     |       |  1200 | 91200 |   179   (2)| 00:00:03 |
    |*  3 |    VIEW                         |       |  1200 | 30000 |    98   (0)| 00:00:02 |
    |*  4 |     COUNT STOPKEY               |       |       |       |            |          |
    |   5 |      VIEW                       |       | 40617 |   475K|    98   (0)| 00:00:02 |
    |   6 |       INDEX FULL SCAN DESCENDING| T_IDX | 40617 |   793K|    98   (0)| 00:00:02 |
    |   7 |    TABLE ACCESS FULL            | T     | 40617 |  2022K|    80   (2)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("T".ROWID="T1"."RID")
       3 - filter("RN">=1190)
       4 - filter(ROWNUM<=1200)
    Statistics
              1  recursive calls
              0  db block gets
            348  consistent gets
              0  physical reads
              0  redo size
           1063  bytes sent via SQL*Net to client
            385  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
             11  rows processed
    SQL> select object_id, object_name, last_ddl_time from (select t1.*, rownum rn from (select * from t order by last_ddl_time desc) t1 where rownum <= 1200) where rn >= 1190 ;
    11 rows selected.
    Execution Plan
    Plan hash value: 882605040
    | Id  | Operation                | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT         |      |  1200 | 62400 |    80   (2)| 00:00:01 |
    |*  1 |  VIEW                    |      |  1200 | 62400 |    80   (2)| 00:00:01 |
    |*  2 |   COUNT STOPKEY          |      |       |       |            |          |
    |   3 |    VIEW                  |      | 40617 |  1546K|    80   (2)| 00:00:01 |
    |*  4 |     SORT ORDER BY STOPKEY|      | 40617 |  2062K|    80   (2)| 00:00:01 |
    |   5 |      TABLE ACCESS FULL   | T    | 40617 |  2062K|    80   (2)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter("RN">=1190)
       2 - filter(ROWNUM<=1200)
       4 - filter(ROWNUM<=1200)
    Statistics
              0  recursive calls
              0  db block gets
            343  consistent gets
              0  physical reads
              0  redo size
           1063  bytes sent via SQL*Net to client
            385  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
             11  rows processed
    SQL> select object_id, object_name, last_ddl_time from t, (select rid, rownum rn from (select rowid rid from t order by last_ddl_time desc) where rownum <= 1200) t1 where rn >= 1190 and t.rowid = t1.rid ;
    11 rows selected.
    Execution Plan
    Plan hash value: 168880862
    | Id  | Operation                      | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT               |       |  1200 | 91200 |   179   (2)| 00:00:03 |
    |*  1 |  HASH JOIN                     |       |  1200 | 91200 |   179   (2)| 00:00:03 |
    |*  2 |   VIEW                         |       |  1200 | 30000 |    98   (0)| 00:00:02 |
    |*  3 |    COUNT STOPKEY               |       |       |       |            |          |
    |   4 |     VIEW                       |       | 40617 |   475K|    98   (0)| 00:00:02 |
    |   5 |      INDEX FULL SCAN DESCENDING| T_IDX | 40617 |   793K|    98   (0)| 00:00:02 |
    |   6 |   TABLE ACCESS FULL            | T     | 40617 |  2022K|    80   (2)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - access("T".ROWID="T1"."RID")
       2 - filter("RN">=1190)
       3 - filter(ROWNUM<=1200)
    Statistics
              0  recursive calls
              0  db block gets
            349  consistent gets
              0  physical reads
              0  redo size
           1063  bytes sent via SQL*Net to client
            385  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
             11  rows processed
    SQL> select object_id, object_name, last_ddl_time from (select t1.*, rownum rn from (select * from t order by last_ddl_time desc) t1 where rownum <= 1200) where rn >= 1190 order by last_ddl_time desc ;
    11 rows selected.
    Execution Plan
    Plan hash value: 882605040
    | Id  | Operation           | Name | Rows     | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT      |     |  1200 | 62400 |    80   (2)| 00:00:01 |
    |*  1 |  VIEW                |     |  1200 | 62400 |    80   (2)| 00:00:01 |
    |*  2 |   COUNT STOPKEY       |     |     |     |          |          |
    |   3 |    VIEW            |     | 40617 |  1546K|    80   (2)| 00:00:01 |
    |*  4 |     SORT ORDER BY STOPKEY|     | 40617 |  2062K|    80   (2)| 00:00:01 |
    |   5 |      TABLE ACCESS FULL      | T     | 40617 |  2062K|    80   (2)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter("RN">=1190)
       2 - filter(ROWNUM<=1200)
       4 - filter(ROWNUM<=1200)
    Statistics
         175  recursive calls
           0  db block gets
         388  consistent gets
           0  physical reads
           0  redo size
           1063  bytes sent via SQL*Net to client
         385  bytes received via SQL*Net from client
           2  SQL*Net roundtrips to/from client
           4  sorts (memory)
           0  sorts (disk)
          11  rows processed
    SQL> set autotrace off
    SQL> spool offAs you will see, the join query here has to have an ORDER BY clause at the end to ensure that records are correctly sorted. You can not rely on optimizer choosing NESTED LOOP join method and, as above example shows, when optimizer chooses HASH JOIN, oracle is free to return rows in no particular order.
    The query that does not involve join always returns rows in the desired order. Adding an ORDER BY does add a step in the plan for the query using join but does not affect the other query.

  • I ask to help on pagination

    I ask to help on pagination
    All greetings! For me a question on pagination
    Has made pagination for the directory of articles on a site, but at addition of new articles in a database, having divided into pages proceeds in a format
    BACK 1 2 3 4 5 6 7 8 NEXT
    So can proceed indefinitely (to 100-200 pages etc.).
    I wish to make, that pagination was in such format:
    BACK 1 2 3 4 5 6 7 8 9 10... NEXT
    That is, that pages were displayed to 10, and the others were not displayed, and began to be displayed, when the user has reached 10 pages, for example:
    BACK... 11 12 13 14 15 16 17 18 19 20 NEXT
    CODE:
    <cfquery name="getArticle" datasource="Article" result="resultInfo">
    SELECT Articles.Id, Articles.title, Articles.anonce, Articles.disc, Articles.add_date, Articles.image, Articles.tag
    FROM Articles
    </cfquery>
    <!--- set how many records you want to display per page --->
    <cfset Result_Per_Page="1">
    <!--- get the total record count from q_fetch query --->
    <cfset Total_Records="#getArticle.recordcount#">
    <!--- set the default value for the offset record set number --->
    <cfparam name="URL.offset" default="0">
    <!--- the limit result set(i.e., end row) --->
    <cfset limit=URL.offset+Result_Per_Page>
    <!--- page results start from? --->
    <cfset start_result=URL.offset+1>
    <!--- make sure that the initial start row is starting from 1 --->
    <cfset URL.offset=URL.offset+1>
    <!--- if the record is their more than one page so show the navigation bar --->
    <cfif Total_Records GT Result_Per_Page>
    <br>
    <!--- Create Previous Link --->
    <cfif URL.offset GT Result_Per_Page>
    <!--- Previous Link Offset --->
    <cfset prev_link=URL.offset-Result_Per_Page-1>
    <cfoutput><b class="numpage_link"><a href="#cgi.script_name#?offset=#prev_link#">BACK</a></b></cfoutput>
    </cfif>
    <!--- Find out how many pages are there for display  --->
    <cfset Total_Pages=ceiling(Total_Records/Result_Per_Page)>
    <!--- now loop it for navigation page numbers --->
    <cfloop index="i" from="1" to="#Total_Pages#">
    <cfset j=i-1>
    <!--- create offset value for page numbers --->
    <cfset offsetvalue=j*Result_Per_Page>
    <!--- deactivate the link if the page number is current page --->
    <cfif offset_value EQ URL.offset-1 >
    <cfoutput><b class="numpage">#i#</b></cfoutput>
    <cfelse>
    <cfoutput><b class="numpage_link"><a href="#cgi.script_name#?offset=#offset_value#">#i#</a></b></cfoutput>
    </cfif>
    </cfloop>
    <!--- create Next Link --->
    <cfif limit LT Total_Records>
    <!--- Next Link Offset --->
    <cfset next_link=URL.offset+Result_Per_Page-1>
    <cfoutput><b class="numpage_link"><a href="#cgi.script_name#?offset=#next_link#">NEXT</a></b></cfoutput>
    </cfif>
    </cfif>
    <!--- display the result on the screen --->
    <cfloop query="getArticle" startrow="#URL.offset#" endrow="#limit#">
    <cfoutput>
    <div class="center_item_line">
    <h4>#DateFormat(Now())# <p>#getArticle.tag# </p></h4>
    <div class=center_item_img><a href="article.cfm?ID=#getArticle.Id#"><img src="../images/#getArticle.image#" width="180" height="133" alt="Новости зарубежной недвижимости"></a></div>
    <h4><a href="article.cfm?ID=#getArticle.Id#">#getArticle.title#</a></h4>
    <p>#getArticle.anonce# </p>
    <div style='clear:both;'></div>
    <br/>
    <div class="line"></div>
    </div>
    </cfoutput> <br>
    </cfloop>
    </body>

    You might want to take a look at the PaginationCFC project at RIAForge.com:
    http://paginationcfc.riaforge.org/
    It looks like a very useful pagination library that could help you manage your large data set output.

  • Pagination problem, help needed to finish it

    Hi friends,
    I am in need to use pagination in my Web Application, since i have a tons of values to display as a report. I develop a pagination logic, tested it seperately and it works fine.When i try to implement it to current project it works, but no result was displayed as it displayed in testing..
    Here is the file i tested seperately..
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
    <%@ page import="com.rajk.javacode.servlets.dbmodel"%>
    <%
    int count=0;
    int userid = 0;
    String g = null;
    dbmodel db=new dbmodel();
    Statement ps = null;
    ResultSet rs = null;
    db.connect();
    String SQL = "select * from tbl_rmadetails";
    ps=db.con.createStatement();
    rs=ps.executeQuery(SQL);
    rs.last();
    count= rs.getRow();
    rs.beforeFirst();
    int currentrs;
    int pagecount=(count/2);
    if((pagecount*2)+1>=count)
    pagecount++;
    out.println("<table width=363 height=20 align=center border=0 cellpadding=0 cellspacing=0><tr><td>");
    for(int i=1;i<pagecount;i++)
    out.println("<font face=verdana size=1><a href=pagination.jsp?pagenum="+ i +"&userid="+ userid +">["+ i +"]</a></font>");
    String pagenum=request.getParameter("pagenum");
    if(pagenum==null)
    out.println("<br><strong><font face=verdana size=1 color=white>Page 1 of " + (pagecount-1) +"</font></strong>");
    currentrs=0;
    else
    out.println("<br><strong><font face=verdana size=1 color=white>Page " + pagenum + " of " + (pagecount-1) + "</font></strong>");
    pagecount=Integer.parseInt(pagenum);
    currentrs=(2*(pagecount-1));
    out.println("</td></tr></table>");
    //messageboard
    String sql="select * from tbl_rmadetails order by date LIMIT " + currentrs + ",2";
    rs=ps.executeQuery(sql);
    while(rs.next())
    %>
    <br>
    <table width="363" height="64" border="1" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
    <tr>
    </td>
    <td width="126" height="19" align="center" valign="top"><font face="verdana" size="1"><strong><%=rs.getString("serial_no")%></strong></font></td>
    <td width="126" height="19" align="center" valign="top"><font face="verdana" size="1"><strong><%=rs.getString("status")%></strong></font></td>
    </tr>
    </table></td>
    </tr>
    </table>
    <%
    rs.close();
    %> And here is the file in which i want to implement the pagination..
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
    <%@ page import="com.rajk.javacode.servlets.dbmodel"%>
    <%
    int x1=0;
    int userid = 0;
    int count = 0;
    String raj=request.getParameter("q");
    String temp=null;
    String SQL = null;
    String SQLX = null;
    int currentrs;
    try
    dbmodel db=new dbmodel();
    Statement ps = null;
    ResultSet rs = null;
    db.connect();
    if(raj.equals("All Vendor"))
    SQL = "SELECT * FROM tbl_rmadetails,tbl_customer,tbl_item,tbl_vendor WHERE tbl_rmadetails.customer_id=tbl_customer.customer_id AND tbl_rmadetails.item_id=tbl_item.item_id AND tbl_rmadetails.vendor_id=tbl_vendor.vendor_id AND tbl_rmadetails.status='STS'";
    else
    SQL = "SELECT * FROM tbl_rmadetails,tbl_customer,tbl_item,tbl_vendor WHERE tbl_rmadetails.customer_id=tbl_customer.customer_id AND tbl_rmadetails.item_id=tbl_item.item_id AND tbl_rmadetails.status='STS' AND tbl_rmadetails.vendor_id=tbl_vendor.vendor_id AND tbl_rmadetails.vendor_id='"+raj+"'";
    ps=db.con.createStatement();
    rs=ps.executeQuery(SQL);
    rs.last();
    count= rs.getRow();
    rs.beforeFirst();
    rs.close();
    int pagecount=(count/6)+1;
    if((pagecount*6)+1>=count)
      pagecount++;
    //out.print(count);
    %>
    <%
    for(int i=1;i<pagecount;i++)
    out.println("<font face=verdana size=1><a href=http://localhost:8080/rmanew/sendtovendor.jsp?pagenum="+ i +"&userid="+ userid +">["+ i +"]</a></font>");
    String pagenum=request.getParameter("pagenum");
    if(pagenum==null)
    out.println("<br><strong><font face=verdana size=1 color=white>Page 1 of " + (pagecount-1) +"</font></strong>");
    currentrs=0;
    else
    out.println("<br><strong><font face=verdana size=1 color=white>Page " + pagenum + " of " + (pagecount-1) + "</font></strong>");
    pagecount=Integer.parseInt(pagenum);
    currentrs=(6*(pagecount-1));
    if(raj.equals("All Vendor"))
    SQLX = "SELECT * FROM tbl_rmadetails,tbl_customer,tbl_item,tbl_vendor WHERE tbl_rmadetails.customer_id=tbl_customer.customer_id AND tbl_rmadetails.item_id=tbl_item.item_id AND tbl_rmadetails.vendor_id=tbl_vendor.vendor_id AND tbl_rmadetails.status='STS' LIMIT"+currentrs+",6";
    else
    SQLX = "SELECT * FROM tbl_rmadetails,tbl_customer,tbl_item,tbl_vendor WHERE tbl_rmadetails.customer_id=tbl_customer.customer_id AND tbl_rmadetails.item_id=tbl_item.item_id AND tbl_rmadetails.status='STS' AND tbl_rmadetails.vendor_id=tbl_vendor.vendor_id AND tbl_rmadetails.vendor_id='"+raj+"' LIMIT"+currentrs+",6";
    rs=ps.executeQuery(SQLX);
    if(rs!=null)
    while(rs.next())
    %>
    <link rel="stylesheet" type="text/css" href="chromejs/stvcss.css" />
    <table width="100%" border="0">
    <tr bgcolor="#0066CC">
    <td align="center"><span class="style2">Date</span></td>
    <td align="center" class="style2">Product Details</td>
    <td align="center" class="style2">Serial No</td>
    <td align="center" class="style2">Fault Desc</td>
    <td align="center" class="style2">Customer Name</td>
    <td align="center" class="style2">Vendor Name</td>
    <tr>
    <tr bgcolor="#CCCCCC">
    <td align="center"><%=rs.getDate("date")%></td>
    <td align="center"><%=rs.getString("item_description")%></td>
    <td align="center"><%=rs.getString("serial_no")%></td>
    <td align="center"><%=rs.getString("fault_desc")%></td>
    <td align="center"><%=rs.getString("customer_name")%></td>
    <td align="center"><%=rs.getString("vendor_name")%></td>
    </tr>
    </table>
    <%
    else
    out.println("Result Set is empty");
    catch(Exception e)
    System.out.println("Error: " + e);
    response.setContentType("text/xml");
    response.setHeader("Cache-Control", "no-cache");
    %>The output i got when i ran this page is..
    [1]
    And no records displayed matching the query, but there is a lot of datas in DB as a result of the queries i mentioned here..
    Please help me friends...

    Debug your code. Check what happens and what happens not.
    You could make it much easier if you wrote Java code in Java classes rather than JSP files. Now it's one big heap of mingled -and thus hard to maintain/test/reuse- code.

  • Need help with pagination for book

    I am working on a book and need help with the pagination. I was able to make the TOC and front matter show the numbers as Roman numerals, and the body of the text as Arabic numerals, but I can't figure out how to restart the numbering sequence for the body of the text. So the front matter is numbered i-xvi, and the text is 17-681. I need the text to start with the number 1. Each subsequent chapter is a section break as well, if that makes a difference.
    Many thanks,
    J

    Click on the page that shall start on number one. Open Inspector palette > Layout inspector (2nd tab) >
    Section > Start at: > 1

  • Help In Paginating Query output

    Hi All,
    I have a query which fetches 80000 records at one short. This fetching can be controlled by using the search criteria. But some times it needs to fetch all the records and populate on the screen. The query fetches and populates more than 50 columns and which takes more time.
    What i want is to fetch all the records but display only 10 of them at a time and provide pagination option like 1,2,3.... So when the user clicks on page 3, he will get the records 21-20 and page 4 records 31-40 and so on. If he want to again view page 1 then he should get records 1-10.
    How can i write a stored procedure to achive this and how to store the counters of this search?
    What is the best way to do this (alternate processes using PL/SQL)?
    Any explanations and solution to this will be of great help.
    Regards
    Swadhin

    Swadhin,
    One quick way I can think of is to have a sort order column in your
    table. The PL/SQL stored procedure would just take the upper and lower
    limits as parameters and query data. You just need to call
    the same procedure, passing it the appropriate upper and lower limits (which
    you would match against the sort order column). The limits would change
    for each link on a page.
    This approach would avoid dumping all the 80k records at one shot which is
    unnecessary. You can also avoid caching data on a client buffer.
    Just one way of doing it. There could be more efficient ways to achieve this.
    Rgds.
    Amogh

  • Help limiting page totals in pagination code

    HI ,
    I have been trying to limit the output of page totals in my pagination code so I can use it at the top of the page. I grabbed the existing code from a tutorial and it works fine. I tried simply settting a page total variable and outputting , but I do realize it's a little ore compicated than that. Any help will be greatly appreciated.
    <div style="padding-top:10px;">
    <p> </p>
    </div>
    <p align="center" class="breadcrumb">
    Top of page setting some vars :
    <!--- set up pagination --->
    <cfset perpage=12>
    <cfparam name="url.start" default="1">
      <cfif not isNumeric(url.start) or url.start lt 1 or url.start gt qry_prod.recordCount or round(url.start) neq url.start>
        <cfset url.start = 1>
      </cfif>
    <!--- outputting  query reslults table rows of product stuff with maxrows set to perpage var--->
          <table>
              <tr>
                   <td> ect ...........................
    <!--- Here I employ the pageination code , displays at bottom of page --- >
      <cfif url.start gt 1>
          <cfset link = cgi.script_name & "?fuseaction=products&action=cat&id=#url.id#&start=" & (url.start - perpage)>
          <cfoutput><a href="#link#">Previous Page</a></cfoutput>
      <cfelse>
          Previous Page
      </cfif>
      |
          <!--- Start Page Number --->
        <cfset pageCount = 1>
        <cfset pageLink = 1>    
        <cfset totalPages = Ceiling(qry_prod.recordCount / perpage)>
        <cfloop index="c" from="1" to="#totalPages#">
          <cfoutput>
          <a href="?fuseaction=products&action=cat&id=#url.id#&start=#pageLink#">#pageCount#</a>
         </cfoutput>
         <cfset pageCount = pageCount + 1>
        <cfset pageLink = pageLink + perpage>
        </cfloop>
        |
        <!--- End Page Number --->
      <cfif (url.start + perpage - 1) lt qry_prod.recordCount>
          <cfset link = cgi.script_name & "?fuseaction=products&action=cat&id=#url.id#&start=" & (url.start + perpage)>
          <cfoutput><a href="#link#">Next Page</a></cfoutput>
      <cfelse>
          Next Page
      </cfif>
      </p>
    Thanks ,
    Steve

    As of now it renders :
    [ Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | Next Page ]
    I would like to limit the output of page numbers ,say to 5 ,  while still being able to click though all of them. Tks.

  • Need help using GO URL to display table view (with sorting, pagination)

    I'm trying to use the GO URL to get to a table view with the sorting and pagination functionality intact, but I don't want all the other links and input fields of a dashboard.
    Is this possible?
    I'm trying to consume table view report in an IFRAME within my web application using the GO URL, but without any luck.
    For proof of concept, I'm trying to extend Sample Lite\KPI\Sample PKI which I can display as a dashboard in my IFRAME, but I would like the table view with the column sorting and pagination functionality intact without the dashboard links and fields up at the top.
    I'm new to Oracle BI, specific explanation and step by step examples would help me tremendously.
    I am on Oracle 11g v11.1.7.0 on RH linux.
    The GO URL I am using:
    http://myserver:port/analytics/saw.dll?Go&NQUser=username&NQPassword=password&Path=/shared/Sample%20Lite/KPIs/Sample%20KPI&ViewName=Table
    Thanks.
    Brian

    TABLES: bkpf.
    TYPES: BEGIN OF ty_bkpf ,
           belnr LIKE bkpf-belnr,
           bukrs LIKE bkpf-bukrs,
           gjahr LIKE bkpf-gjahr,
           bldat LIKE bkpf-bldat,
           waers LIKE bkpf-waers,
           END OF ty_bkpf.
    TYPES: BEGIN OF ty_bseg ,
           buzei LIKE bseg-buzei,
           shkzg LIKE bseg-shkzg,
           END OF ty_bseg.
    DATA: it_bkpf TYPE STANDARD TABLE OF ty_bkpf ,
          it_bseg TYPE STANDARD TABLE OF ty_bseg .
    DATA: ibinding TYPE salv_t_hierseq_binding.
    DATA: xbinding TYPE salv_s_hierseq_binding.
    DATA: gr_table TYPE REF TO cl_salv_hierseq_table.
    SELECT-OPTIONS:
      ndoc FOR bkpf-belnr,
      empr FOR bkpf-bukrs,
      anod FOR bkpf-gjahr.
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM relat_tables.
      PERFORM display_alv.
    *&      Form  get_data
    FORM get_data .
      SELECT belnr bukrs gjahr bldat waers
             INTO TABLE it_bkpf
             FROM bkpf
             WHERE belnr IN  ndoc AND
                   bukrs IN empr AND
                   gjahr IN anod.
      IF sy-subrc = 0.
        SELECT buzei shkzg
               FROM bseg
               INTO TABLE it_bseg
               FOR ALL ENTRIES IN it_bkpf
               WHERE belnr = it_bkpf-belnr AND
                     bukrs = it_bkpf-bukrs AND
                     gjahr = it_bkpf-gjahr.
      ENDIF.
    ENDFORM." get_data
    *&      Form  relat_tables
    FORM relat_tables .
      xbinding-master = 'BUKRS'.
      xbinding-slave  = 'BUKRS'.
      APPEND xbinding TO ibinding.
    ENDFORM. " relat_tables
    *&      Form  display_alv
    FORM display_alv .
      cl_salv_hierseq_table=>factory(
      EXPORTING
      t_binding_level1_level2 = ibinding
      IMPORTING
      r_hierseq = gr_table
      CHANGING
      t_table_level1 = it_bkpf
      t_table_level2 = it_bseg
      gr_table->display( ).
    ENDFORM. " display_alv

  • Help in pagination w/ save feature

    hi,
    can somebody help me with my jsf code.
    basically this code displays inputText in tabular view and is paginated. The problem is when i press the save button.
    <h:form>
                    <h:dataTable value="#{catsh.all}" var="cat" id="pager" rows="3">
                        <%-- ID column --%>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Cat ID" style="font-weight: bold"/>
                            </f:facet>
                            <h:outputText value="#{cat.id}"/>
                        </h:column>
                        <%-- Name column --%>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Name" style="font-weight: bold"/>
                            </f:facet>
                            <h:inputText value="#{cat.name}" size="16"/>
                        </h:column>
                        <%-- Sex column --%>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Sex" style="font-weight: bold"/>
                            </f:facet>
                            <h:inputText value="#{cat.sex}" size="1"/>
                        </h:column>
                        <%-- Weight column --%>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Weight" style="font-weight: bold"/>
                            </f:facet>
                            <h:inputText value="#{cat.weight}" size="16"/>
                        </h:column>
                    </h:dataTable>
                    <p>
                    <h:commandButton value="Save" action="#{catsh.save}"/>
                    <corejsf:pager dataTableId="pager" showpages="5" selectedStyleClass="currentPage"/>
                </h:form>

    Hi,
    Use binding attribute to bind (for example) to UIData and the changes you did will be available in the UIData component. Upon clicking save button access the values from UIData component.
    Thanks
    Ansar

  • Need help  Pagination Suppourt with DataGrid

    Hi ,
    When i do a search Operation , the data from Database is huge and i think if i display all of them at a Time it will be a performance and response Time issue .
    So the question i am asking is that , can any body please give me a basic idea as how to implement Pagination with DataGrid Results ??
    Need help with Datgrid and Pagination suppourt .
    Thnaks in advnace .

    Hi Kiran,
    Try referring to the below link...
    http://www.flexicious.com/
    Thanks,
    Bhasker Chari.S

  • Ik probeer in elements 12 een afbeelding te doezelen. Ik volg de instructies op de help-pagina, maar kom er niet uit. Kan iemand mij een aanzet geven?

    Ik probeer in elements 12 een afbeelding te doezelen. Ik volg de instructies op de help-pagina, maar kom er niet uit. Kan iemand mij een aanzet geven?

    Ik probeer in elements 12 een afbeelding te doezelen. Ik volg de instructies op de help-pagina, maar kom er niet uit. Kan iemand mij een aanzet geven?

  • Pagination Error. Please Help

    I am using JDBC rowset for pagination. While, starting tomcat, iam getting the following NotSerializableException in eclipse console.
    SEVERE: Exception loading sessions from persistent storage
    java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: com.mysql.jdbc.SingleByteCharsetConverter
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1303)But in browser, it displays the table values and pagination links like Prev,1,2,Next. But clicking any page link 1 or 2, it displays the Invalid Column name SQLException in browser
    SQLException:
    SEVERE: Servlet.service() for servlet jsp threw exception
    java.sql.SQLException: Invalid column name
         at com.sun.rowset.CachedRowSetImpl.getColIdxByName(CachedRowSetImpl.java:1638)
         at com.sun.rowset.CachedRowSetImpl.getInt(CachedRowSetImpl.java:2581)
         at org.apache.jsp.xyz_jsp._jspService(org.apache.jsp.xyz_jsp:59)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)I also posting the jsp codes for your reference.
    pagination.jsp
    <%@page import="com.sun.rowset.CachedRowSetImpl"%>
    <%@page import="javax.sql.rowset.CachedRowSet"%>
    <%@page import="java.sql.Connection"%>
    <%@page import="java.sql.DriverManager"%>
    <html>
    <body>
    <%
         String mysqlDriver = "com.mysql.jdbc.Driver";
         String url = "jdbc:mysql://127.0.0.1/sampledb";
         String userName = "root";
         String password = "mysql";
         Class.forName(mysqlDriver);
         Connection conn = DriverManager.getConnection(url,userName,password);
         out.println("Connection is established");
         CachedRowSet crs = new CachedRowSetImpl();
         crs.setCommand("select count(*) as UserId from credentials");
         crs.execute(conn);
         crs.next();
         session.setAttribute("crs", crs);
         session.setAttribute("conn", conn);
         CachedRowSetImpl crs1 = new CachedRowSetImpl();
         crs1.setCommand("select * from credentials");
         crs1.execute(conn);
         session.setAttribute("crs1",crs1);
         session.setAttribute("conn",conn);
    %>
    <jsp:forward page="xyz.jsp"/>
    </body>
    </html>
    xyz.jsp
    <%@page import="javax.sql.rowset.CachedRowSet"%>
    <%@page import="java.sql.Connection"%>
    <html>
    <body>
    <%!int currentPageNum;
         int totalPageCount;
         String pageNum;
         int currentrs = 0;
         int prevPage;%>
    <%
    CachedRowSet crs= (CachedRowSet) session.getAttribute("crs");
    Connection conn = (Connection) session.getAttribute("conn");
         int numOfRecs = crs.getInt("UserId");
         int pageCount = (numOfRecs/5);
         if(pageCount == 0) {
              totalPageCount = (numOfRecs/5);
         } else {
              totalPageCount = numOfRecs/5;
              totalPageCount = totalPageCount + 1;
         pageNum = request.getParameter("pageNum");
         if(pageNum == null) {
              pageNum = "1";
              currentPageNum = Integer.parseInt(pageNum);
         } else {
              currentPageNum = Integer.parseInt(pageNum);
              currentrs = (5*(currentPageNum - 1));
    %>
         <center>
         <table>
         <tr>
         <th>UserName</th>
         <th>Password</th>
         </tr>
         <%
         crs.setCommand("select * from credentials limit " + currentrs + ",5");
         crs.execute(conn);
         while(crs.next()) {
         %>     
              <tr>
              <td><%out.println(crs.getString(1));%></td>
              <td><%out.println(crs.getString(2));%></td>
              </tr>
         <%
         %>
         </table>
         <br>
         <%
         prevPage = currentPageNum;
         prevPage--;
         if(prevPage > 0){
              out.println("<a href=xyz.jsp?pageNum=" + prevPage + ">Prev</a>");
         } else {
              out.println("Prev");
         for (int i=1; i <= totalPageCount ; i++) {
              out.println("<a href=xyz.jsp?pageNum="+ i +">["+ i +"]</a>");
         int nextPage = currentPageNum + 1;
         if(nextPage == totalPageCount) {
              out.println("<a href=xyz.jsp?pageNum="+ nextPage +">Next</a>");
         } else {
             out.println("Next");
         %>
         </center>
         </body>
         </html>Please help.

    hi,
    do u have column name as UserId in your credentials table?
    if so then make changes in your code as follows,
    <%@page import="javax.sql.rowset.CachedRowSet"%>
    <%@page import="java.sql.Connection"%>
    <html>
    <body>
    <%!int currentPageNum;
         int totalPageCount;
         String pageNum;
         int currentrs = 0;
         int prevPage;%>
    <%
    CachedRowSet crs= (CachedRowSet) session.getAttribute("crs");
    1. CachedRowSet crs1= (CachedRowSet) session.getAttribute("crs1");
    Connection conn = (Connection) session.getAttribute("conn");
         //int numOfRecs = crs.getInt("UserId");
    2. int numOfRecs = crs.size();
         3. int pageCount = (numOfRecs%5);
         if(pageCount == 0) {
              totalPageCount = (numOfRecs/5);
         } else {
              totalPageCount = numOfRecs/5;
              totalPageCount = totalPageCount + 1;
         pageNum = request.getParameter("pageNum");
         if(pageNum == null) {
              pageNum = "1";
              currentPageNum = Integer.parseInt(pageNum);
         } else {
              currentPageNum = Integer.parseInt(pageNum);
              currentrs = (5*(currentPageNum - 1));
    %>
         <center>
         <table>
         <tr>
         <th>UserName</th>
         <th>Password</th>
         </tr>
         <%
         4. crs1.setCommand("select * from credentials limit " + currentrs + ",5");
         crs1.execute(conn);
         while(crs1.next()) {
         %>     
              <tr>
              <td><%out.println(crs1.getString(2));%></td>
              <td><%out.println(crs1.getString(3));%></td>
              </tr>
         <%
         %>
         </table>
         <br>
         <%
         prevPage = currentPageNum;
         prevPage--;
         if(prevPage > 0){
              out.println("<a href=xyz.jsp?pageNum=" + prevPage + ">Prev</a>");
         } else {
              out.println("Prev");
         for (int i=1; i <= totalPageCount ; i++) {
              out.println("<a href=xyz.jsp?pageNum="+ i +">["+ i +"]</a>");
         int nextPage = currentPageNum + 1;
         if(nextPage == totalPageCount) {
              out.println("<a href=xyz.jsp?pageNum="+ nextPage +">Next</a>");
         } else {
         out.println("Next");
         %>
         </center>
         </body>
         </html>
    I have checked it with the above mentioned changes. Its work fine for me.
    Edited by: Thilagavathi on Sep 22, 2008 6:29 AM

Maybe you are looking for