CachedRowSet Pagination

Section 10.0 of the javadoc for CachedRowSet has this example.
CachedRowSet crs = new CachedRowSetImpl();
crs.setPageSize(5);
crs.execute(conHandle);
Did they forget to set the command? I assume that is the case. What is not clear is how the connection handle is managed. I think it's safe to assume we close the connection handle. The bigger question is pagination. This makes no sense to me:
To access the next page (chunk of data), an application calls the method nextPage. This method creates a new CachedRowSet object and fills it with the next page of data.I have the saame CachedRowSet object. I assume they mean it repopulates itself?
The data from the first CachedRowSet object will no longer be in memory because it is replaced with the data from the second CachedRowSet object.The data is replaced, NOT the CachedRowSet object, right? Nothing in the example shows the object reference being replaced.
Big question: where is it getting the next page from? That all-important issue is not even discussed. If the CachedRowSet has one page in memory and you call pageNext, WHERE does it get the data? Is it keeping my connection open? If so then I cannot close it, right? Maybe it's keeping the data in a temp file and paging that?
The CachedRowSet documentation is clear as mud. Any clarification would be greatly appreciated.

Writing raw Java code with the JDBC API in a JSP file instead of a Java class and having problems with the JDBC API doesn't make it a JSP problem. Get rid of that scriptlet clutter and just put it all nicely in a Java class and test it independently as a Java application using main().
There's a JDBC forum around for problems with the JDBC API.

Similar Messages

  • 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

  • Issue in pagination of pivotal view (10 rows per page)???

    Hi All,
    I’m implementing pagination in pivotal view, report has to show 10 records per page.
    Report has to show for 8 weeks data per employee and 10 employees information per page, however report is displaying data for more than 10 employees and for a week single week, in second page its showing for 2 week and so on ….
    I used all the following functions however issue persists.
    1. FLOOR(RCOUNT(1) /10)
    2. CEILING((RCOUNT(1))/10.0)
    3. TRUNCATE((RCOUNT(1)-1)/10, 0) +1
    4. CASE when rcount(1)<11 then '1-10' when rcount(1)<21 then '11-20' when rcount(1)<31 then '21-30' else '30+' end
    Any suggestions
    Thanks,
    SMA

    Look in criteria add one more column
    in FX write this formula
    Go to the formula window of this column and enter the formula shown below
    CASE WHEN RCOUNT(1) < 11 THEN ‘1-10′
    WHEN RCOUNT(1) < 21 THEN ‘11-20′
    WHEN RCOUNT(1) < 31 THEN ‘21-30′
    ELSE ‘30+’ END
    Once this is done, drag and drop this column into the Pages section of your pivot table. Now you can paginate through your pivot table report.
    let us know if its solve your problem
    Thanks

  • 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.

  • Pagina inicial padrão Default

    Utilizo o Mozilla firefox como navegador padrão de toda a rede da empresa que é baseada em linux (ubuntu). A instalação do firefox foi feita "manualmente" no diretório "/opt/firefox" exatamente da forma que a Mozilla sugeri.
    O que estou precisando é "setar" a pagina inicial (HOME) de todos com a minha intranet, consegui fazer essa alteração apenas quando o firefox é instalado pelo repositorios (apt-get) que você faz a alteração no /etc/firefox/syspref.js adicionando a linha:
    user_pref("browser.startup.homepage","www.intranet.xxxx.net");
    . Gostaria de saber qual arquivo eu altero para fazer essa configuração, quando mando instalar no /opt/firefox , ou como fazer para que o firefox utilize o syspref.js do /etc para configura-lo.
    Vi que o firefox cria uma pref.js quando o usuário faz login, mas ele cria uma parta K42dk.Default (numero aleatório). que da para configura-lo, mas para isso tenho que esperar o usuário fazer o primeiro login e eu quero fazer que a pagina inicial com a intranet, aparece no default, já no primeiro login do usuário... existe essa possibilidade ?!?
    Desde já Agradeço.
    Obrigado

    Se na versão disponibilizada pelo ubuntu, você conseguiu fazer as alterações necessárias, por que não usá-la?

  • Problem in pagination

    hi,
    I am working on the pagination concept using JSP and SQL.
    I written stored procedure for pagination..its nicely working and i am using callable statement to call the procedure in my jsp code....if i am passing values within the parameter ..i am getting the answer....but i have to get the value at runtime...
    In my jsp code.i am calling the procedure like this:
    java.sql.CallableStatement proc =
    cn.prepareCall("{call newPage2('%telic%',2,10,24)}");
    its working fine...But i have to get the string from html..I have get the values at runtime rather than passing the values directly...
    Details about the above parameters which i have used in my code :
    The string that be searched - "telic"
    2 = Refers to the current page
    10 = page size(no of items per page)
    24 = total number of records;
    for Example if i am searching for the word "telic".I have the fields in the database such as names,address.
    The word "telic" has to be searched in the above fields.
    My doubts are:
    1) How do i pass the text from the HTML to the stored procedure.
    2) I am not sure about passing the values to a stored procedure at runtime.
         java.sql.CallableStatement proc =
    cn.prepareCall("{call newPage2(?,?,?,?)}");
         How should i pass the values at runtime instead of "?" mark.
    3)Suppose if i am using the getParameter method to get the string value..How can i pass the string variable instead of question mark(?).
    can anyone help me...
    Thanks in advance.

    Read the documentation for CallableStatement. There are methods for setting parameters.
    http://java.sun.com/j2se/1.4.2/docs/api/java/sql/CallableStatement.html

  • Number of currently displayed rows in report with pagination?

    Maybe I'm thinking to complicated, but ...
    In my report I use the HTMLDB_ITEM.CHECKBOX function in order to display a checkbox for each row:
    HTMLDB_ITEM.CHECKBOX(1,"ID",NULL,:P311_ASSIGNED,':') " "
    Some of the checkboxes are selected depending on whether there is an entry for them in a database table.
    As the report returns hundreds of rows, I use pagination (e.g. 15 rows per page).
    After checking/unchecking the checkboxes and submitting the page by clicking the save button, I want to do the following: For each row CURRENTLY DISPLAYED on the screen (1) check, whether its checkbox is currently checked or not (2a) If it is checked and there is not yet an entry -> add row to the db table (2b) If it is unchecked and there is an entry in the db table -> remove row from db table.
    How can I, on the server side, find out which rows (row ids) are currently displayed (using pagination), so that I check each of the currently displayed row ids for their existence in the database table? Is there any item stored on the server side, which tells me the row number of the first row currently displayed? Is there an item I can refer to, which tells me the amount of rows, which are displayed on one page?
    Your help would be very much appreciated!
    Konrad

    Hi Konrad,
    I will jump in. :-) Just have a few minutes before a meeting.
    I think you don't have to make it that complicated, where you have to know the current pagination.
    1) Your HTMLDB_ITEM.CHECKBOX has to contain as checked value #ROWNUM# as the row selector would do it.
    2) You have to create a hidden item where you store your customer id
    3) create another hidden item where you store if the customer has already the assignment
    4) In your process you are now able to loop through your arrays.
    DECLARE
        vRowNumber BINARY_INTEGER;
        vFound BOOLEAN;
    BEGIN
        -- insert new event assignments
        FOR ii IN 1 .. WWV_Flow.g_f01.COUNT -- your checkbox
        LOOP
            vRowNumber := WWV_Flow.g_f01(ii);
            -- no assignment yet?
            IF WWV_Flow.g_f03(vRowNumber) IS NULL -- your hidden field where you store if you have an assmnt
            THEN
                INSERT INTO xxx VALUES (WWV_Flow.g_f02(vRowNumber)); -- your customer id
            END IF;
        END LOOP;
        -- delete old event assignments
        FOR ii IN 1 .. WWV_Flow.g_f03.COUNT -- your hidden field where you store if you have an assmnt
        LOOP
            -- only if the event was already assigned
            IF WWV_Flow.g_f03(ii) IS NOT NULL
            THEN
                vFound := FALSE;
                FOR jj IN 1 .. WWV_Flow.g_f01.COUNT -- your checkbox
                LOOP
                    -- is the event still checked?
                    IF WWV_Flow.g_f01(jj) = ii
                    THEN
                        vFound := TRUE;
                        EXIT;
                    END IF;
                END LOOP;
                IF NOT vFound
                THEN
                    DELETE xxx WHERE CUSTOMER_ID = WWV_Flow.g_f02(ii);
                END IF;
            END IF;
        END LOOP;
    END LOOP;Haven't tested the code, but I think it should show the idea.
    Hope that helps
    Patrick
    Check out my APEX-blog: http://inside-apex.blogspot.com

  • Not getting all records in pagination

    I am also have a problem getting all records in the report as the post on Apr. 21,2004. My reports pagination stops at 500. When I set the 'max row count' to 100000. The pagination at the bottom of my page disapears. When I leave 'max row count' empty, it only goes from 1-500. No way to view records past the 500th record.
    I see there was a post on Apr. 21, 2004 about the same thing but it did not specify a fix or work around or if I'm missing a setting. (also tried the log off/on but did not help).
    *My pagination Scheme is 'Row Ranges 1-15 16-30 in select list(wiht pagination)'
    *My report has 1000+ records.
    Thanks, Paula

    The actual number of rows supported by the select list depends on how many rows you show on each page. If you go with the default of 15 rows, you would be able to use the select list with close to 5000 rows. If you increase the number of rows per page, the select list will work with even more rows.
    If the select list can't be used, it may make sense to consider using the "row ranges with set pagination" style. Set pagination lets you navigate from one set to the next instead of one page to the next, so you can navigate through your result set a lot quicker.
    However the best option for reports with that many rows would be "row ranges x-y", without showing the total number of rows. The reason is that the report renders a lot faster if you don't have the total number of rows calculated. In order to better be able to find certain records, I would recommend a search field on your report page that lets you filter the result set.
    Hope this helps,
    Marc

  • Report problem (Paginations show record count, report blank)

    I am using a custom report template to show data in detail form and allowing users to use the pagination to move from record to record. I have the maximum rows returned as 1.
    The problem is in a very specific set of circumstances if the query returns only two results the report shows nothing. The pagination show two records (using search engine pagination style) but nothing (with the exception of the top and bottom pagination bars) is displayed until the user clicks on one of the linked numbers.
    Has anyone had similar problems, does anyone have any idea how to correct this problem?
    Thanks in advance.
    Gary

    Check any branches to this page to see that they have "reset pagination for this page" checked. I had a problem with pagination where the user could specify query criteria and the branch back to the page was not resetting the pagination.
    Just a thought,
    Mike

  • Expanding text boxes, pagination and expanding to another page

    Attached is a link to a simple form which is actually part of a much larger form. It has several nested add and remove instances. I have three fairly simple issues I need to solve.
         1. Is it possible to set a text box to allow it to grow in height as information is added that exceeds the size of the text box. This feature is available as a property in Microsoft Access as an example. I know you can allow multiple lines but you can see them all without the expanding feature.
         2. This form is design to grow by adding instances. I would like to set up the pagination so it would flow to additional page(s). I think I would just like the line
    to continue to flow to the next page without creating a break in the primary instance if that makes sense (the top level of the instances - mode). This level could theoretically by larger than one page so this is probably best route to go. Currently it's not flowing at all to the 2nd page.
         3. Somehow I ended up with a 2nd page to the form. How do I delete that but yet have the expanding form automatically create a 2nd, 3rd (etc) page as required.
    http://share.planswift.com/download/?file=W0H3U2V5-GOPO-FI9G-1UIG-OTYPHTB46HB
    Thanks,
    Patrick

    Hi Patrick,
    I can't make changes to your form at the moment, but there are a few things you need to bear in mind. If you want items to expand and push objects down, then you will need a Flowed layout.
    See this example about making fields dynamic: http://assure.ly/g80MVY.
    Also this looks at the difference between Flowed (where you want to get to) and Positioned (where you are now) subforms: http://assure.ly/eSGQMt.
    Yes, just select the textfield and go to the LAyout palette. There under height, tick Expand to fit. If you preview this you will see that it expands, BUT will cross over objects beneath it. This is where you need to group objects in a Flowed subform, so that when it expands it will push objects down.
    The page needs to be set to Flowed. There are pagination settings available under the Object palette and you can start with Place = Follow previous and then Continue filling parent. You also want to make sure that for the subforms (and textfields) you have set in the Object palette that content is allowed to break over pages.
    Check your pagination settings.
    Hope that helps,
    Niall

  • Adding form pagination without the wizard

    Hello,
    I'm trying to add a form pagination feature into an existing page. When I'm trying to use the Create Form Pagination Wizard I'm getting the following error: "The Create Form Pagination Wizard uses the onChange JavaScript event to alert users when they are about to exit a page without saving their changes. Remove the onChange event from any item with a source of Database Column and restart the wizard."
    I have many items on this page with onchange event, and I really don't want to erase all of then, using the wizard, and retyping them again. Is there a way to bypass this problem? I'm actually looking to use the " Get Next or Previous Primary Key Value" process. Can I manually create this process without the "help" of the wizard?
    Thanks,
    Arie.

    Arie - Perhaps you could create a temporary form page with a "clean" form and then create the form pagination process there. Then copy that process to your existing form page. After the copy, edit the process and change all the item names, column names, etc., in the process definition page and create any items required to support it. Finally, delete the temporary form page.
    Scott

  • Custom pagination for APEX 4.2 interactive report using Page Zero

    Hi,
    I want to implement an «Custom pagination for APEX 4.2 interactive report» using a «page zero».
    I recently migrate from Apex 3.1 to Apex 4.2 and my «Custom pagination for APEX 3.1 interactive report» using a «page zero»  is not working any more.
    So now I try to adapt an excellent example of Jari Laine for 4.0 but using a page zero.
    I put the code JavaScript to Page zero but I must create an dynamic action to fire only for an interactive report region.
    It’s a good idea?
    Thank you

    Thought I would try once more with my DatePicker question.
    On the Apex.Oracle.Com website I have created a 1 page application that has an Interactive Report.
    [url http://apex.oracle.com/pls/apex/f?p=15655:1]
    user = 'test'
    password = 'test'
    I have 2 questions :
    (1) In IE7, press 'Actions', 'Filter'. On the Column dropdown list, select 'Order Timestamp'.
    Notice the prompt icon to the right of the 'expression'. This should change to the Datepicker, but in IE7 it does not. Try the samething in Firefox or Chrome and the Datepicker will appear.
    Is this a BUG, or does Apex 4.02 not support IE7 ?
    (2) In Firefox or Chrome, where you can now see the Datepicker, you will notice that it is the new style picker, not the old style ( called 'classic' ). I want to change it so that it shows the 'classic' datepicker not the new, but cannot see how to do it, if indeed you actually can.
    I would really appreciate it if someone could take a look and let me know if I am going mad, or if we need to get all our users onto IE8. We have now gone live with Apex 4.02 and need to resolve these issues.
    Thanks in advance.
    Edited by: DooRon on 10-Mar-2011 05:13

  • Mixing of interactive report and classic report fails the RESET PAGINATION process.

    I have a tab page where i got 3 different reports REPORT_A (classic), REPORT_B(interactive)  and REPORT_C (CLASSIC) in the same alphabetic order. I have a reset pagination page process which will always fire (without any condition) when you visit the page via tab.
    The reset pagination process which exists in the before header stage is firing but not resetting the interactive report. It does affect the subsequent classic report REPORT_C as well. The REPORT_A would reset pagination fine since it exists before the interactive report. Is this a know bug in apex?
    I created a test demo application with exact steps to reproduce the problem. The steps are in the demo website itself.
    http://apex.oracle.com/pls/apex/f?p=56638
    U: testuser
    P: password
    Apex Version: 4.2.4.00.08
    In my real application i would have a dropdownlist in the page based on which I would filter the data. The dropdownlist will have a corresponding after-submit branch which will handle the reset pagination & RIR absolutely fine. But when we visit the website through tab the above problem would crash the page.
    I tried solutions like gReport.search('SEARCH') but that will fix only the interactive report, not the classic REPORT_C. That is just a hack anyway.
    Any ideas.?

    Ramani_vadakadu wrote:
    in classic report pagination need to be make it up max rows in APEX_SCHEMA(APEX_040200) itself. i was fixed this issue long back myself,but right now i don't remember which table! so please check the schema and track it.
    This makes very little sense to me. Please explain this in detail. Are you advocating making changes to APEX metadata by executing DML on tables in the APEX_040200 schema? Doing so will leave your APEX instance in an unsupported an possibly inoperable state.

  • Problem of POP LOV  in a  SQL Report  with pagination

    I am using a pop up lov (along with some other fields), HTMLDB_ITEM.POPUP_FROM_LOV(5, null, 'EMPLOYEE_LIST', '20', '50')), in a sql report. This is a report with pagination. Whenever I select any value from pop up lov on first page of the report it gets populated properly in the corresponding text field. But from second page onwards it doesn’t populate any value.
    For example, my report fetches a total of 50 rows, of which I am displaying 15 at a time. The popup lov comes with a text field for each row. Whenever I do select from popup lov for 1-15 rows which come on page 1, the values come up in the text field properly, but for rows 16-30 on second page, 31-45 on third 46-50 on fourth the values do not get populated. When I changed the pagination settings to display 40 rows..the values were still coming properly on page 1(1-40 rows) and not on the next page. Any clues… how to resolve this problem?

    good find. this is a bug that has already been identified and will be corrected in the upcoming patch release for htmldb. a good work-around for now is to use the equivalent declarative options in the tool. so rather than coding your query like...
    select ename , HTMLDB_ITEM.POPUP_FROM_LOV(2, null, 'DEPARTMENT', '20', '50') as "department" from emp
    ...just code it like this...
    select ename , null as "department" from emp
    ...and then use the column attributes screen for your "department" column to indicate that you'd like that col to be rendered as a "Popup LOV (named LOV)" using your DEPARTMENT list of values.
    hope this helps,
    raj

  • Updateable Report/Pagination - rows found but not displayed

    Bear with me if there is a post that covers this, as the SEARCH facility seems to be hanging when I search on Pagination.
    I have a SQL Query (PL/SQL Function Body Returning SQL Query) which creates an Updatable Report.
    If I run the Query and the selection criteria results in more than one page in the "search results" and then I go to page 2 or page 3, etc and then peform another search that only results in 1 page of "search results", the actual search results will not display, but the pagination will show the number of rows that should be displaying.
    For example, I search on Coroner "John Black", which returns 55 rows. The first 50 are displayed. The next 5 are on page 2. If I then searchon Coroner "Jim Bean", 22 rows are returned (all on page 1). If I then search on "John Black" again, and this time, go to page 2 (to see the final 5 rows in the result set) and then search on "Jim Bean", I won't get any data in the report for Jim Bean, but a message showing that there are 22 rows of data. However, I cannot get that data to show (even if I select NEXT or PREVIOUS for the pages.
    Then if I go back and select on "John Black", get the same problem. I basically have to sign out completely in order to get this reset.
    Note that the problem occurs if you are on a page greater than that of the result set on the next query. For example, if I am on page 3 of 5 pages and perform another selection that has 3 pages, it is fine. But if the result set only has 2 pages, the form becomes confused.
    If the "Layout and Pagination" has a "Pagination Scheme" set to "Row Ranges X to Y of Z (no pagination)" I get an error like "Minimum row requested: 2401, rows found but not displayed: 46".
    If I use "Row ranges 1-15 16-30 (with set pagination)" I get "1-46" as a hyperlink, which if I click on, will show me the report.
    If I use "Row ranges 1-15 16-30 in select list (with pagination) I have a problem.
    If I use "Row Ranges X to Y (no pagination) I have problems.
    If I use "Row Ranges X to Y of Z (no pagination) I have problems.
    If I use "Row Ranges X to Y of Z (with pagination) I have problems.
    Basically, the one one that seems to work is those that have a hyperlink. Uing NEXT, PREVIOUS or a select list does not seem to work.
    Do you know what is causing this problem?

    I have the same issue, but cannot resolve it following above suggestions. I have a report page with search criteria and a "Go" button to submit the search. The branch back to the same page has "reset pagination for this page" checked, but still if run a query that returns just one row after having paged forwards, I get no rows displayed and a pagination link "1-1" that when clicked brings up the selected row.
    I tried adding a "Reset Pagination" process to run on submit (unconditionally), and it made no difference.
    I am using HTMLDB 2.0.

Maybe you are looking for

  • Not able to submit a pet on the seller screen of Petstore 2.0...

    Hi, If all other parts of the application works correctly, it could be a library conflict. If the portal container is deployed or you have an early version of Apaches commons fileupload libraries in your system classpath, then submitting a pet will f

  • Help! Speaker no longer works!

    My speaker is now longer working! I can only hear someone on the phone is it is on "speaker phone." I've tried doing a soft reset. Any suggestions?

  • Is it normal for a app to take a hour to download

    It's Martha Stewart makes cookies thanks

  • Plants for PO

    Hi, We have multiple company codes/plants tobe used in PO release procedure. When I try to assign all multiple plants for a class I dont see any plant names appearing there but its defined in enterprise structure. Should I assign the plant to each ch

  • Aperture - new serial number

    hello! I need some help. My friend let me use his aperture serial number to install the program on my computer so that I could see if I liked it before purchasing it. After using it a little I decided to buy one for myself. I installed the newly purc