Display rows as page wise

Hello,
I have a requirement to display the limited records from the query which returns large number of records.
Assume that select * from orders order by order_id is giving me 1000 rows.
now i have to do a filter, display records from 25 to 50 or 50 to 150 etc...
i can pass the start range and number of records to be displayed as an input parameter to the query.
above example, start range is 25 and number of records should display is 25 from 25th record to next 25 records. (something like , select * from orders order by order id where rownum between 25 and 50)
again, start range is 50 and number of next records should display is 100 starting from 50th record to next 150 record.(something like , select * from orders order by order id where rownum between 50 and 150)
how can i achive this using a query. remember the start range and number of display count i can pass as an input to the query.
Appreciating the great help...
good day

Are you really sure that you need PARTITION BY clause in the row_number() function?
SQL> var p_start number
SQL> var p_range number
SQL> exec :p_start := 2
PL/SQL procedure successfully completed.
SQL> exec :p_range := 6
PL/SQL procedure successfully completed.
SQL> SELECT *
  2    FROM (SELECT   a.*, rownum rn
  3              FROM emp a
  4          ORDER BY sal)
  5   WHERE rn BETWEEN :p_start AND :p_start + :p_range
  6  /
     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO         RN
      7900 JAMES      CLERK           7698 03-DEC-81        950          1         30          8
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250          1         30          5
      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          1         30          7
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600          1         30          6
      7782 CLARK      MANAGER         7839 09-JUN-81       2450          1         10          3
      7698 BLAKE      MANAGER         7839 01-MAY-81       2850          1         30          2
      7566 JONES      MANAGER         7839 02-APR-81       2975          1         20          4
7 rows selected.
SQL> SELECT *
  2     FROM (SELECT   a.*, row_number() over (order by sal) rn
  3               FROM emp a
  4           ORDER BY sal)
  5   WHERE rn BETWEEN :p_start AND :p_start + :p_range
  6  /
     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO         RN
      7900 JAMES      CLERK           7698 03-DEC-81        950          1         30          2
      7876 ADAMS      CLERK           7788 12-JAN-83       1100          1         20          3
      7521 WARD       SALESMAN        7698 22-FEB-81       1250          1         30          4
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250          1         30          5
      7934 MILLER     CLERK           7782 23-JAN-82       1300          1         10          6
      9999 MILLER     CLERK           7782 23-JAN-82       1300          1         10          7
      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          1         30          8
7 rows selected.
SQL>
SQL>Cheers
Sarma.

Similar Messages

  • Displaying bulky ResultSet page wise, in jsp!

    Hello Guyes,
    I am back to the most asked problem again! I have a massive resultset of 5,000 records and I want to display it page wise in my jsp with giving 'Next' and' Back' buttons. I can open the resultset on each page as it will kill my application and server!
    Pls help and give a simple solution in which I can do it!
    It is very urgent!
    Thanks,
    - Rahul

    USE a Scrollable ResultSet object and put it in the session. Keep a variable that identifies where in the resultset ur pointer is at any point of time.
    Scrollable ResultSets are a feature only available with JDBC 2.0 onwards... so make sure u have THAT first.
    Create a Statement like this...
    Statement st =
    con.createStatement(ResultSet.SCROLLABLE);
    Then run the query n store it in the resultset
    ResultSet rs = st.executeQuery(sql);
    Then move ur pointer to any record u want with methods present in the ResultSet interface:
    relative(int rows) that takes you 'rows' rows ahead.
    absolute(int row) that takes your pointer to the 'row'th ROW.
    Make sure u use 'refreshRow()' so u have the latest content at any point of time. This refreshes the contents in that row. there is also something called refresh() BUT THAT would minimise performace.
    Store this resultset object in the session and call it in each page u want starting with the record number u want to. !!
    Hope this helps... aXe!

  • Page wise display through a query

    hi all,
    i have a 3 records displayed block and i have more than 30 rows/records from a select query.
    i want display all the data page wise one by one by clicking specified 4 buttons .
    i have 4 buttons 1st for first page, 2nd for nest page, 3rd for last page and 4th for previous page.
    how can i do this page wise query display through programming in oracle forms 10g.
    for a query you can take (select * from emp;)
    can anybody help me to do this.

    Base your block on query, execute-query and scroll using following:
    For first and last page buttons :
    first_record;
    last_record; Next page and Prev page requires little more coding...
    Next Page:
    go_record(:system.cursor_record + get_block_property('block',RECORDS_DISPLAYED ));Prev Page:
    go_record(get_block_property('block',TOP_RECORD)- get_block_property('block',RECORDS_DISPLAYED ));Also take a look in forms help on scroll_up , scroll_down buit-in. They do not do exactly page up/down, but may be it's good enough for you
    Make sure buttons set as Mouse Navigate=No
    Edited by: Slava Natapov on Apr 23, 2010 1:25 PM

  • Rows Per Page doesn't affect the number of records displayed

    I just updated from 3.2 to 4.0 this morning. When I change the Rows Per Page value in the action menu the report doesn't change and the number of records displayed stays at 10. The report has ~6000 records. I edited the report attributes and add the rows selector to the IR search bar. This doesn't change the behavior either. I noticed that if I change the rows per page in the action menu then the drop down select list is updated, but the report still doesn't change from 10. I tried paging to the next set of results and it still remains at 10.
    Has anyone else experienced this problem?
    Tony

    Yes, Tony, I've seen this in several versions of APEX. In most cases, simply starting a new session was enough to force APEX to refresh the page and grab the new set of pagination directives. If that doesn't work, please give more info like: what type of report you are doing and what the Pagination values are. Please note the following:
    Report Template
    Pagination Scheme
    Enable Partial Page Refresh
    Display Position
    Number of Rows/Number of Rows Item
    Maximum Row Count

  • How to display page wise totals in Smartforms

    hi,
    I created Tax Invoice for SD my quetion is i have 10 items 5 items are displaying in first page and rest of 5 items are displaying next page.
    in first page 5 items i have to display the total amount in first page and same like second page also please help me.
    regards

    Hi,
    Create two global data variables called pag_total & currentpage and initialize currentpage as 1.
    if currentpage <> sfsy-page.
       pag_total = 0.
       pag_total = pag_total + column value(which values u want to add).
       currentpage = sfsy-page.
    else.
       pag_total = pag_total + column value(which values u want to add).
    endif.
    Write these lines in main area table row of that particular column cell and store the SFSY-page value also in a global variable(currentpage).
    Then write the pag_total variable in the footer.
    Thanks,
    Venkat

  • Page Wise Count of rows

    Hi ,
    How to get page wise count of rows of the inner repeating group?
    Thanks in advance.
    --Basava.S                                                                                                                                                                                                                       

    Hi Dimant,
    I used countrows. If the dataset set contains 12 rows I am getting the o/p as shown below. I just need one row. Can please help me out.
    Thanks
    sush

  • OBIEE 11g: Report not displaying maximum rows per page

    I have an OBIEE report that is not displaying the maximum rows per page. When I click on the UP/DOWN arrow at the bottom of the report there is no change.

    Hi,
    Refer the below link.
    http://satyaobieesolutions.blogspot.in/2012/08/limit-row-in-table-and-graph-in-initial.html
    OR,
    https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=1198961.1
    Add the following to your instanceconfig and then restart the presentation service.
    file path
    D:\Oracle\Middleware\instances\instance1\config\OracleBIPresentationServicesComponent\coreapplication_obips1\instanceconfig.xml just add below lines
    <Views>
    <Pivot>
    <MaxCells>6500000</MaxCells>
    <MaxVisibleColumns>100</MaxVisibleColumns>
    <MaxVisiblePages>100</MaxVisiblePages>
    <MaxVisibleRows>65000</MaxVisibleRows>
    <MaxVisibleSections>25</MaxVisibleSections>
    <DefaultRowsDisplayed>500</DefaultRowsDisplayed>
    <!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager--><DefaultRowsDisplayedInDelivery>75</DefaultRowsDisplayedInDelivery>
    <!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager--><DefaultRowsDisplayedInDownload>65000</DefaultRowsDisplayedInDownload>
    <!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager--><DisableAutoPreview>false</DisableAutoPreview>
    </Pivot>
    <Table>
    <MaxCells>6500000</MaxCells>
    <MaxVisiblePages>100</MaxVisiblePages>
    <MaxVisibleRows>65000</MaxVisibleRows>
    <MaxVisibleSections>25</MaxVisibleSections>
    <DefaultRowsDisplayed>500</DefaultRowsDisplayed>
    <!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager--><DefaultRowsDisplayedInDelivery>75</DefaultRowsDisplayedInDelivery>
    <!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager--><DefaultRowsDisplayedInDownload>65000</DefaultRowsDisplayedInDownload>
    </Table>
    </Views>
    Hope this help's
    Thanks,
    Satya

  • Disabling the display maximum rows per page

    My project include many reports with table view, displaying 100 rows.
    There is always arrows icon with the option to display maximum rows per page.
    If user click on that option the OBIEE crashed, since there are a lot of rows.
    I cannot decrese this number since all rows are required for other charts views.
    a. Is there a way to set this parameter only for the table view?
    b. Is there a way to disable this icon or not presenting it to the user?
    c. Is there global way to coonfigure the default displayed rows number (e.g. from 100 to 20)?

    unfortunately, you are limited to the SRW built-ins in Reports as far as setting object properties is concerned. I have checked this with the Metalink staff and I did get an admission out of them that this is true.
    You can set the property in the property palette, but I'm not sure that this helps you as I take it you have a condition you would like to implement. I wish I could help you further, but Reports is limited in some areas, and setting object properties programmatically is one of them.

  • How to make a table to display perticular number of rows per page??

    Hi,
    Can anybody tell how to ristrict the number of rows per page in SSRS?
    I have a table in my report.I know we have to use" =Int(RowNumber(Nothing)/25)" in group expression.But I already have 3 group expression in my table.Where to write??
    Thanks.

    Hi Tony ,
    Just wanted to know will this solution work ;
    I am having a report and its using a grouping expression on “Group on 
    (=Field!Salelocation)” when it add another group on the details and have the page calculation such as (=Ceiling(RowNumber(Nothing)/20)) 
    and assign the page break at to the point of saving its ok , when trying to upload the report then it throws the following error .
    I have tried your solution trying to give the page calculation the upper group but still the following error comes back
    “A group expression for the grouping ‘table2_Group1’ uses the RowNumber function with a scope parameter that is not valid. When used in a group expression, the
    value of the scope parameter of RowNumber must equal the name of the group directly containing the current group. (rsInvalidGroupExpressionScope)
    Get Online Help
    A group expression for the grouping ‘table2_Group2’ uses the RowNumber   function with a scope parameter that is not valid. When
    used in a group   expression, the value of the scope parameter of RowNumber must equal the name   of the group directly containing the current group.   (rsInvalidGroupExpressionScope)
    Get Online Help
    Will you able to assist me on this.

  • How to process double click on rows of data displayed on html page?

    I need to display rows of data so that user could double click on a particular row to get more details.
    What I could think of doing is to embed an applet with a JTable that could easily process double click event. But the issues I have are:-
    1. I am not able to pass the data (the jsp got from processing some javabeans) to be displayed on the applet's table. It seems the applet needs to get loaded on the user's browser first and then the applet could ask the server (servlet / jsp) to send the data.
    Is there any way to provide data to applet other than html's parameter/value pairs?
    2. As per design, this applet should be used only to display the content. Double click on a row would only open a browser window to display the entire details of the data; there should not be any interaction with the server.
    Is there a better, more elegant way of doing this?
    Thanks.

    I posted a thread on Applet servlet communication here:
    http://forum.java.sun.com/thread.jsp?forum=33&thread=205887
    It uses the ObjectOutput/InputStream so you can send serializable objects rather than just text.
    Cheers,
    Anthony

  • 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

  • Problem with "PL/SQL Dynamic Content" and displaying rows

    hi,
    im new to APEX, and pl/sql [but not web dev or sql].
    ive found the bit in APEX that lets you add data from your DB using the 'CREATE' > 'PL/SQL Dynamic Content'.
    maybe there's a better option for people who dont know pl/sql? i dont know?
    however, i think i can getting working with a little bit of help but im stumbling around in the dark a bit here.
    ok so this is the pl/sql ive come up with to show three example values on page 23 of my aplplication:
    BEGIN
    SELECT ID, NAME, OWNER
    FROM COM_MAILSHOTS
    INTO :P23_ID, :P23_NAME, :P23_OWNER;
    END;
    im getting the error:
    1 error has occurred 
    ORA-06550: line 5, column 21: PL/SQL: ORA-00933: SQL command not properly ended ORA-06550: line 4, column 1: PL/SQL: SQL Statement ignored
    thanks for reading!

    Metabaron wrote:
    hi,
    im new to APEX, and pl/sql [but not web dev or sql].
    ive found the bit in APEX that lets you add data from your DB using the 'CREATE' > 'PL/SQL Dynamic Content'.
    maybe there's a better option for people who dont know pl/sql? i dont know?
    The easiest (and best) way to "display rows" is using a report. Dynamic PL/SQL regions are more complex and are required much less frequently.
    The Oracle® Database 2 Day + Application Express Developer's Guide tutorial explains how to create reports and other basic APEX techniques.

  • Report Painter Column Header to display on continuing page

    Gods of FICO,
    I've report painter issue. When out of a report is printed, and when it is longer than one page..... the column header description is not getting displayed on second page.
    how can i show column header description on subsequent pages?
    thanks

    Hi,
    I have the same issue. I have also de-selected the 'Allow row to break across pages' for the whole table but still the table breaks and continues on the next page.
    I see that the question has been answers correct but no solution provided. I would appreciate if you could post the solution.
    Regards,
    Hakan
    Edited by: HakanB on 2011-maj-04 00:05

  • XML Publisher - Page Wise Total

    We are facing problem in incorporating ‘Page Wise Total’ in Invoice Report - Invoices print at format CAP_ETA for Germany. It an XML Report and its output appear in PDF format. As per the new requirement sent by L1 team, we are required to make changes in RTF, to show ‘Page Wise Total’.
    We have worked on this enhancement but unable to display ‘Page Wise Total’. We are able to display Sum Total of all the records appeared in three different blocks of records for that particular page at the end of the footer of Page, but not yet able to SUM UP total of these three Sum Total of three different blocks on that particular page.
    For e.g. First page of my XML Report display three different Block of data as shown below with Subtotal of 38,600.00, 4,453.47 for 1st and 2nd Block respectively, but 3rd block records appeared partially on the first page and remaining appeared on the next page. So My Report should display ‘Page Wise Total’ or ‘Amount Forward’ as 52853.47, which sholud be carried forward to next page as ‘Amount Forward’ - 52853.47. The next page/second page will dispaly the remaing line records of the 3rd block and Subtotal( Please see attachment New_Layout_Invoice_TUM_English.doc)
    Name Description Unit Quantity Price Amount in Euro
    Rösner Fees Day 17.00 1,400.00 23,800.00
    Schreiber, Clemens Fees Day 2.00 1,400.00 2,800.00
    Slegers, Arnd Fees Day 4.00 1,400.00 5,500.00
    Weiler, Andreas Fees Day 4.00 1,400.00 6,400.00
    Subtotal: 27.00 38,600.00
    Römer, Michael Expenses 2,253.79
    Schreiber, Clemens Expenses 157.69
    Slegers, Arnd Expenses 519.78
    Weiler, Andreas Expenses 1,522.21
    Subtotal: 4,453.47
    Rösner, Michael Travel expenses 2,400.00
    Schreiber, Clemens Travel expenses 2,000.00
    Siegers, Arndt Travel expenses 1,800.00
    Weiler, Andreas Travel expenses 2,000.00
    Marek, Gruchala Travel expenses 1,600.00
    Amount forward 52853.47
    As mentioned above we are able to show independently three different Page Wise Total of each of these blocks by using syntax:
    <?add-page-total:block1amount;’L_AMOUNT’?>, this syntax is used to sum up all the line records appeared in a block for a particular page and
    <?show-page-total: block1amount;’#####.##0,000’;’ ###.##0,000)’?> is used to display the Sum Total calculated by above syntax.
    But we are not able to further sum up all these Page Wise Total of different blocks.
    Please find attached copy of RTF file from Production (V18_CAR253E1), copy of RTF (V18_CAR253E1_TEST Where we are testing these new changes) and .out XML output file.
    I need help on this issue
    Thanks & Regards,
    Praveen S Negi
    [email protected]
    91-09930799325

    Hi Praveen,
    You got the solution for page total in Invoice Report in XML publisher report.
    Can you pls help regarding the same, i want to display total amount in the invoice report.
    Thanks in advance,
    Sunny

  • How to set number of rows in "Rows Per Page Selector" in Interactive Report

    Hi Guys,
    Is there any way to set the number of rows in "Rows Per Page Selector" in Interactive Report. By default it is set to 15.
    I know one way is to change the number of rows when you are running the report and then set that as 'Default Report Setting'.
    If anybody is aware of any other way, please let me know.
    Cheers,
    Ashish Agarwal
    http://www.dbcon.com.sg

    Hi Pavel,
    can you please specify your question more clearly. If you are on NW 7.0 you can determine a number of colums for your filter item with following command:
    COLUMNS
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/85/08e241aa8e9d39e10000000a155106/content.htm
    If you meant the amount of rows within the analysis item you can use following command within your analysis item:
    BLOCK_ROWS_SIZE   (numbers of rows displayed at once)
    BLOCK_ROWS_STEP_SIZE  (numbers of rows to be scrolled for one step)
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/76/489d39d342de00e10000000a11402f/content.htm
    Brgds,
    Marcel
    Edited by: Marcel Landsfried on Feb 10, 2009 7:45 PM
    Edited due to wrong url

Maybe you are looking for

  • Using CORR function with sub-queries

    I need to compute the correlation of two datasets, however here is my problem: The table stores responses to a questionnaire, with these columns: RESPONSE_ID, QUES_ID, ANS_CD What my query needs to get is the Correlation of 2 sets of ANS_CD, one with

  • Basic html page will not display for my client!

    I have built a new website for a client, and I have plonked it in a folder on his server so that he can view it without it being live, but when he views it from his office, the url (which is correct) loads a page stating that the page could not be fo

  • What generation is the iPod classic from Apple's website?

    I am looking to purchase an iPod classic 160GB from Apple's website, and I would like to purchase a third-party casing from Amazon. After browsing Amazon, I realised that the iPods were classified as 6G,7G or earlier generations and I am pretty confu

  • Using buffering option in select query

    Hi All,        Can anybody give me a brief idea on , where we will use the buffering and how we will write it in coding part.Similarly please tell me what will happen if we use  by passing buffering  addition in select query. Please explain  it with

  • Table declaration in Standard Program

    Hi to all, I just want to know that I have seen in the standard program the declaration of table in the following way. TABLES: bkdf,         bkpf,         *bkpf. then what is this *bkpf means. Thanks Dharmishta