To divide the table based on number of rows

Hello,
I am trying to divide a table based on the number of rows and then to process it.
Say i have a table TEST_XXX which contains 50 rows, what i would like to do is,
to access rows in multiple of 10. How can we do this ?
What i was thinking is, once the table gets created and row are filled in,
add a new column to the table and run a procedure which inserts 1 to first 10 rows
and 2 to next 10 rows and 3 to next 10 row ...etc. Based on this we can process
the first set of rows then next set or rows etc ....
is there a better way to do this ?
Code to create the table :
CREATE TABLE TEST_XXX
  A_ID   VARCHAR2(10),
  B_ID   NUMBER,
  c_ID   VARCHAR2(10),
  D_ID   NUMBER
)Code to add rows:
DECLARE
BEGIN
  FOR I IN 1..50
  LOOP
      INSERT INTO TEST_XXX VALUES('ABCDE',123,'ZYXWV',321);
  END LOOP;
  COMMIT;
END;The original problem is, i do have a huge table, and i write a sql query to process it,
when i process it selecting all values from table, it is very slow.
But when i process it in small chuks(say 100 rows) it works fine.
Thats how i was the above approach in mind.

The original problem is, i do have a huge table, and i write a sql query to process it,
when i process it selecting all values from table, it is very slow.Did you trace both the implementations and see why it is taking longer?

Similar Messages

  • Displaying the table based on number of records.

    Hi Experts,
    I want to display a normal table based on the records, if there is only one record then only one row should be displayed on the table, if there are 2 records then 2rows should be displayed on the table with the data, if they are more than 2 records only 2 rows should be displayed on the table and remaining rows should be able to scroll on the table.
    Please Provide the requried infformation.
    Thanks & Regards.
    Bhushan.

    Hi Bhushan
      What exactly is row scroll? Did you not refer to the vertical scrollbar that appears when the number of rows is more than the number of displayed rows? Please clarify
    If it is the vertical table scroll bar you refered to then you will get it if the number of records are more than the visibleRowCount you set
    If it is the horizonal table scroll bar you refered to then you will get it by setting a fixed width to the table. If your column(s) value width exceeds the table width you have specified, you get the horizontal scrollbar.
    Regards,
    Gayathri Shanbhag

  • Is it possible to find the  table based on the Date ?

    Dear Team ,
    Is it possible to find the table based on the Date ?
    I have created an table ,But forgot the Table Name .
    Is it possible to find the Tables created on particular Date .
    Regards ,
    Augustine

    as date is record the time also below query will work.
    select * from user_objects
    where
    object_type = 'TABLE' and
    to_date(created,'DD-MON-YYYY') =to_date('<your date value in DD-MON-YYYY format>','DD-MON-YYYY');
    Edited by: shaileshM on Feb 24, 2010 9:39 PM

  • Select the table based on 2 months ? Query no working

    I have a table TEST1 in schema MESSAGE_REPORT. What i want to do is select the table based on 2 months ( JULY and AUGUST ). The requirement is Whole JULY data should be there and for AUG the data should be till 01 aug . Below is the query i m using but its giving me error . Moreover the Where clause "TRUNC(HIRE,'MONTH') " part is compulsary to be used ,changes have to be made in the ">= timestamp '2010-07-01 00:00:00' and frd.sent_timestamp < timestamp '2010-08-10 00:00:00';" part only . please can anyone help me out
    NAME        HIRE
    SALE     01.07.2010 00:00:00,000000000
    cops     15.07.2010 00:00:00,000000000
    NAVEED     31.07.2010 00:00:00,000000000
    HEN     01.08.2010 00:00:00,000000000
    BEN     10.08.2010 00:00:00,000000000
    CROSS     15.08.2010 00:00:00,000000000
    select * from MESSAGE_REPORT.test1 where
    TRUNC(HIRE,'MONTH') >= timestamp '2010-07-01 00:00:00' and frd.sent_timestamp < timestamp '2010-08-10 00:00:00';
    ERROR:
    ORA-00904: "FRD"."SENT_TIMESTAMP": invalid identifier
    00904. 00000 -  "%s: invalid identifier"
    *Cause:   
    *Action:
    Error at Line: 24 Column: 60Edited by: user12633486 on Aug 11, 2010 1:13 PM
    Edited by: user12633486 on Aug 11, 2010 1:51 PM

    Thats becuase you are comparing with Month and not the complete date.
    Check this:
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 'SALE' col1,'01.07.2010 00:00:00' col2 from dual
      2  union all select 'cops','15.07.2010 00:00:00' from dual
      3  union all select 'NAVEED','31.07.2010 00:00:00' from dual
      4  union all select 'HEN','01.08.2010 00:00:00' from dual
      5  union all select 'BEN','10.08.2010 00:00:00' from dual
      6  union all select 'CROSS','15.08.2010 00:00:00' from dual)
      7  select * from t
      8  where
      9  TO_DATE(col2,'DD.MM.RRRR HH24:MI:SS') >= timestamp '2010-07-01 00:00:00'
    10* and TO_DATE(col2,'DD.MM.RRRR HH24:MI:SS') < timestamp '2010-08-10 00:00:00'
    SQL> /
    COL1   COL2
    SALE   01.07.2010 00:00:00
    cops   15.07.2010 00:00:00
    NAVEED 31.07.2010 00:00:00
    HEN    01.08.2010 00:00:00
    SQL>
    -- For less than equal to
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 'SALE' col1,'01.07.2010 00:00:00' col2 from dual
      2  union all select 'cops','15.07.2010 00:00:00' from dual
      3  union all select 'NAVEED','31.07.2010 00:00:00' from dual
      4  union all select 'HEN','01.08.2010 00:00:00' from dual
      5  union all select 'BEN','10.08.2010 00:00:00' from dual
      6  union all select 'CROSS','15.08.2010 00:00:00' from dual)
      7  select * from t
      8  where
      9  TO_DATE(col2,'DD.MM.RRRR HH24:MI:SS') >= timestamp '2010-07-01 00:00:00'
    10* and TO_DATE(col2,'DD.MM.RRRR HH24:MI:SS') <= timestamp '2010-08-10 00:00:00'  -- less than equal to includes data for 10th august as well
    SQL> /
    COL1   COL2
    SALE   01.07.2010 00:00:00
    cops   15.07.2010 00:00:00
    NAVEED 31.07.2010 00:00:00
    HEN    01.08.2010 00:00:00
    BEN    10.08.2010 00:00:00
    SQL> Edited by: AP on Aug 11, 2010 1:31 AM
    Edited by: AP on Aug 11, 2010 1:32 AM

  • List Table names and number of rows in it

    Following is a piece of code that would list all tables in a schema and the number of rows in each table.Hope it is helpful for you.
    Note: In this example iam selecting only those tables starting with 'T_'. you may replace it accordingly.
    create or replace procedure count_lines is
    cursor cur is select tname from tab where tname like 'T\_%' escape '\';
    lines number;
    begin
    dbms_output.put_line(rpad('TABLE_NAME',65,' ')||'NUMBER_OF_LINES');
    dbms_output.put_line(rpad('-',80,'-'));
    for i in cur loop
    execute immediate 'select count(*) from '||i.tname into lines;
    dbms_output.put_line(rpad(i.tname,70,' ')||lines);
    end loop;
    end count_lines;
    Following is the sample output:(ignore alignment here)
    TABLE_NAME NUMBER_OF_LINES
    T_FR_ACTION 3
    T_FR_ATTRIBUTE 52
    T_FR_ATTRIBUTE_TYPE 3
    T_FR_ATTRIBUTE_VALUE 5389

    This has been covered many times, so your solution is not the only way...
    http://laurentschneider.com/wordpress/2007/04/how-do-i-store-the-counts-of-all-tables.html
    Re: count rows in shema tables
    And there's many more if you search

  • Conditionally display button based on number of rows in rpt query results?

    I know that I can conditionally display a button based on the number of rows returned in a query entered in the condition. However, I have a report region button that I only want to display if any data was returned by a report query. Since I've already executed the query to generate the report, I do not want to execute it again to determine whether any rows were returned. Is there any way to detect whether any rows were returned for a report other than to reissue the query?

    http://htmldb.oracle.com/pls/otn/f?p=24317:52
    OK, so it looks like it contains the rowcount of the report region rendered just before the variable (apex_application.g_flow_total_row_count) is referenced.
    Sort of like how SQL%ROWCOUNT contains the no. of records affected by the last SQL DML statement.
    Note that the pagination scheme affects the result. In the example above, the 2nd report region is showing 10 rows with a 'Rows X to Y' pagination scheme. So g_flow_total_row_count=11 because I guess the reporting engine has to fetch the 11th row (and discard it) to determine whether to render the 'Next' pagination link.
    If you select a pagination scheme that forces the reporting engine to fetch all the rows 'Rows X to Y of Z', g_flow_total_row_count will always be Z, not the number of rows actually rendered on the screen.
    Thanks

  • Table's max number of rows

    Hi,
    I am a newbie to Oracle and I would like to get you comment of the following questions:
    1. What it the maximun number of rows that a table should have in order to be adequately handled in the sense of Create, Read, Update and Delete?
    2. To be more specific , let say I have the following table:
    file_id (INT)
    senetence_id (INT)
    sentence (CLOB)
    Primary key (file_id, senetence_id)
    The queries I would like to do are:
    select - select all sentences for a certain file_id
    insert - insert a new sentence (for a specific file_id)
    delete - delete a sentence for a specific file_id.
    search - get all sentences that contain a specifc string
    The table's size is going to growth and could get to millions and even more.
    Could i get into a point where I couldn't "work" with the table.
    Thank you in advance for your assitance
    Edited by: user9341163 on Mar 15, 2010 12:46 AM

    Hi,
    Welcome to forums.oracle.com
    I am not sure of what you are looking for, DB itself used for storing information irrespective of Size of data (as its going to increased day by day).
    The queries I would like to do are:
    select - select all sentences for a certain file_id
    select *
    from <table_name>
    where file_id = <specific_fileid>
    insert - insert a new sentence (for a specific file_id)
    insert into <table_name>
    select <specific file_id>, <sentence>,EMPTY_CLOB()
    from dual
    or
    insert into <table_name> values (<specific file_id>, <sentence>,EMPTY_CLOB())
    delete - delete a sentence for a specific file_id.
    delete from <table_name> where file_id = <specific file_id>
    search - get all sentences that contain a specifc string
    select from <table_name> where file_id = <specific file_id>
    I could not able to understand further, are you looking specific to CLOB in your table. ??
    - Pavan Kumar N
    - ORACLE 9i/10g - OCP
    - oracleinternals.blogspot.com

  • How to Capture a Table with large number of Rows in Web UI Test?

    HI,
    Is there any possibility to capture a DOM Tabe with large number of Rows (say more than 100) in Web UI Test?
    Or is there any bug?

    Hi,
    You can try following code to capture the table values.
    To store the table values in CSV :
    *web.table( xpath_of_table ).exportToCSVFile("D:\exporttable.csv", true);*
    TO store the table values in a string:
    *String tblValues=web.table( xpath_of_table ).exportToCSVString();*
    info(tblValues);
    Thanks
    -POPS

  • How to check if a field in the table is same in all rows??

    Hi Folks,
    Is there a feature in abap where we can check if a field in a table is same in all rows.
    Thanks,
    Matt

    This can be easily self-programmed
    read itab index 1.  "get first row
    "now check if exeists any entry with different value
    read itab with key field1 ne itab-field1 transporting no fields.
    if sy-subrc = 0.
      "not all rows have the same value
    else.
      "all rows have the same value
    endif.
    Regards
    Marcin
    Right now I noticed that using NE operator is not allowed in READ TABLE statement, but you can do simple loop instead
    read itab index 1 into l_field1.  "get first row
    loop at itab where field1 ne l_field1.
       flag = 'X'.
       exit.
    endloop.
    if flag = 'X'.
      write: 'some fields are not equal'.
    endif.
    Edited by: Marcin Pciak on Oct 6, 2009 5:35 PM

  • ADOBE Form Using Table with dynamic number of rows

    Hi All
    First some information about our infrastructure:
    - AdobeDesigner 7.1 in the Developerstudio
    - SAP-Portal 7.0 SP15
    I have a View with tabstrips and behind the tabs i have defined an event. On one Tab I included a ADOBE-Form with Table. The Data for the PDF sould only filled in the context for the Form when i jump to this Tab. I created the Form by using this documentation [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e0859ad1-53aa-2a10-78ae-99e41c407669].
    To fill the tablecontext I use the following Code:
    IPrivateAnlegenBANFView.IPositionenElement position = null;
    IPrivateAnlegenBANFView.IPositionenNode posNode = wdContext.nodePositionen();
    int NUM_5_TIMES = 5;
    for (int i = 0; i < NUM_5_TIMES; i) {
    IPrivateAnlegenBANFView.IPositionenElement posElement = wdContext.createPositionenElement();
    +posElement.setMaterial("" + i);+
    +posElement.setKurztext("Test" + i);+
    +posElement.setWarengruppe("Warengr" + i);+
    posNode.addElement(posElement);
    If i put this code in the wdDoInit method it  works fine and shows me 5 Rows. But if I put the code in the Action of the tabstrip it shows me only one row. I checked the entries of the context and there are 5 entries (showed them in a WD-Table).
    Can someone tell me what im doing wrong?
    Thanks for a answer and kind regards
    Pascal

    Hi All
    finally i found the solution for the problem.
    When you define the interactive Form in the view do not define the property "dataSource" of UI-Element Interactive Form it seems, that the binding is static and not dynamic.
    Add the following source to the viewCotroller
    Global Part of the Source:
    private static IWDInteractiveForm form = null;
    Method wdDoModify:
    if (firstTime) {
      form = (IWDInteractiveForm) view.getElement("InteractiveForm");
    When you have an Event where you fill your Contextnode which you want to display in the table of an Adobe Form Use this code:
    Action:
    public void onActionFillTab(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent ){
      //@@begin onActionFillTab(ServerEvent)
         * Code to fill the Node for AdobeForm Table
        form.bindDataSource(wdContext.nodeTabelle().getNodeInfo());
      //@@end
    If you want to clear your table and show it directly use in the action the following code:
    wdContext.nodeTabelle().invalidate();
    form.bindDataSource(wdContext.nodeTabelle().getNodeInfo());
    Kind regards
    pascal

  • Fetch the records based on number

    Hi experts,
        I have a req like if user give input as 5..it should fetch 5 records from database.
    for example database values are
    SERNR                MATNR
    101                                              A
    102                                              A
    103                                              A
    104                                              A
    105                                              A
    106                                              A
    107                                              A
    If user gives the input as 5 it should fetch 5 records like 101 to 105....Can any body plz help me how to write select query for this..
    Thanks in advance,
    Veena.
    Edited by: s veena on Jan 18, 2011 5:52 AM

    Hi Veena,
    You can use UPTO in your select query. For example
    SELECT MATNR FROM MARA INTO TABLE IT_MATNR UPTO P_NUMBER ROWS.
    "Here P_NUMBER is the Selection Screen Parameter
    It will fetch records based on the number in the parameter.
    Thanks & Regards,
    Faheem.

  • Compare two tables having different number of rows based on 2 columns

    Hi,
    I am having two tables table a having field1, field2 and table b having fields field1 and field2.
    I want those records from table a in which field1 of table a is not matching to field1 of table b and field2 of table b not matching to field2 of table b, but i also want the bifurcation of records as whether field 1 is not matching, field 2 is not matching or both fields 1 & 2 are not matching.
    e.g.
    table a table b
    field1 field2 field1 field2
    1 6 12 5
    2 5 1 9
    13 51 13 51
    45 31 99 121
    33 45
    In this case my output should be
    table a
    field1 field2 Mtchng_Field
    1 6 Field 2 not mtchng
    2 5 Field 1 not mtchng
    45 31 Feild1 and Field2 both not matching
    How would i get my result in the required format.

    sql>select * from t1;
    N1 N2 
    1   6 
    2   5 
    13  51 
    45  31 
    33  45 
    sql>select * from t2;
    N1 N2 
    12  5 
    1   9 
    13  51 
    99  121
    sql>
    select n1,n2,decode(nvl(p1,0)+nvl(p2,0),0,'No match',1,'F2 not match',2,'F1 not match','Match') status
    from(
      select n1,n2,(select 1
                   from t2 where n1=t1.n1) p1,(select 2
                                           from t2 where n2=t1.n2) p2
    from t1);
    N1 N2 STATUS 
    1   6   F2 not match 
    2   5   F1 not match 
    13  51  Match 
    45  31  No match 
    33  45  No match
    Message was edited by:
            jeneesh
    Message was edited by:
            jeneesh
    Some problems...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Table name and number of rows

    SELECT 'analyze table '||table_name||' compute statistics for table;'
    from user_tables;
    SELECT table_name,num_rows
    FROM user_tables; Hi I am getting null NUM_ROWS column what could be the reason and how can I fix it?

    It works ... for me however.....!!!!
    SQL> create table f(b varchar2(10) , g number(2));
    Table created
    SQL> insert into f values('5',4);
    1 row inserted
    SQL> insert into f values('e',4);
    1 row inserted
    SQL> commit;
    Commit complete
    SQL> select table_name,num_rows from user_tables where table_name='F';
    TABLE_NAME                       NUM_ROWS
    F                             
    SQL>
    SQL> begin
      2   for r in ( select table_name from user_tables )
      3   loop
      4   execute immediate 'analyze table '||r.table_name||' compute statistics for table';
      5   end loop;
      6   end;
      7  /
    PL/SQL procedure successfully completed
    SQL> select table_name,num_rows from user_tables where table_name='F';
    TABLE_NAME                       NUM_ROWS
    F                                       2
    If you repeat the above simple test don't you get the same results.....????
    Sim
    Message was edited by:
    sgalaxy

  • How to conditional display Report Region based on number of rows returned

    I have a page with two Report Regions.
    One Region should display if the Query returns 0-1000 rows. The other should display if the same Query returns more than 1000 rows.
    The only way I can figure out how to do this is have ANOTHER query in the conditions field for each Region to Select count(*) from etc.
    I know there is a #TOTAL_ROWS# value but that is only available after the Region is displayed. Is there some other built-in variable that can be used to put in the Conditions field or is doing duplicate SQL queries the only way?
    Any help would be appreciated.

    Rather than running your query 4 times (by embedding it in your condition), you can have a region that is not displayed, with a hidden item, and set the value of the item in a before header computation to the count of your query. Now you can conditionally display based upon the value of that item.
    -- Sharon

  • Change the size of and number of rows retrieved in Popup Key LOV

    I have a Page Item of type Popup Key LOV (Displays description, returns key value).
    There are 100+ rows returned but each "page" in the popup window only holds 10, then the user has to click next to see the next 10 rows. Where can I change this setting so that 25 rows are returned per page?
    Also, is there a way to make this popup window wider so that a long string doesn't wrap, but stays on a single row.
    Edited by: mimi_jones on Nov 20, 2009 9:48 AM ADDED: APEX 3.1.1 Oracle 10g

    Go to Shared Components in the Application Builder for your app.
    Go to Templates.
    Go to Popup LOV template.
    The Window section allows you to change the height and width. The Pagination section allows you to change how many entries you see per page.
    Boris

Maybe you are looking for

  • Is there any difference of the Downloading speed of Folio if i'm in Enterprise or Professional Editi

    Hi Adobe, I have compared the downloading time between Adobe Multi-Viewer and Zinio App(also hosting digital magazine), I found out that it is so much faster in Zinio. Are there any difference of the downloading speed if let's say the I'm in Enterpri

  • Convert mp4 format to mp3,wmv,etc in nokia mobile

    Hey, i'm using a nokia 7230 mobile handset, which doesn't support mp4 vedios which i download from the internet. I hate connecting my phone to the computer just to convert the vedios and back.. So is there an app i can download to convert mp4 vedios

  • Authenticated users blocked by rbl

    Hi, I have a user who is now having email sent via our server blocked by an rbl. The email being sent was to me, so we both have an account on the same server and no other mail server was involved. Is there a way to configure Postfix to accept all in

  • How to configure axis value range in combo charts

    I am trying to create a combo chart, where one value axis contains values in the millions, and the other contains values less than ten. When I create the chart, it appears that I can only define one range that applies for both axis. Does someone know

  • Please explain the scenario

    Experts Please explain below scenario 1.Create a Formula variable with processing by replacement path 2.Assign it to the key figure associated with the characteristic 3.Create a new key figure based on the formula variable 4. Set the exception thresh