Retrieval of number of rows in table

Hi, I need to retreive information from a database and put it into a temp array, but i'm not sure howto go about doing it.
     while(rs.next()) {
     for(int i=0; i<selection.length; i++){
     String[] selection = rs.getString("Virtual_host_name");
How do I go about changing the above codes to what I want?

Hi, I do not know how to count the number of rows first because I need to determine rsLength b4 I can use the for loop. How do I do it?
Do I just use:
while(rs.next()) {     
rsLength++;
b4 this??:
String selection [] =new String [rsLength];
     while(rs.next()) {
     for(int i=0; i< rsLength; i++){
     selection[i] = rs.getString("Virtual_host_name");
     out.print(selection);
please advice me on this matter. thanks in advance!

Similar Messages

  • Searchin pattern in datbase table.(Number of rows in table :More than 3 cro

    Actually i have a db table having 2 columns(columnA,time).db table has 70lac rows.I have to retireve all those values which are present min. 2 times in the interval of 10 minutes for a particular value of columnA. eg. columnA,time values are
    {a,June-01-2011 10:13:12},{b,June-01-2011 10:14:12},{b,June-01-2011 10:15:12},{c,June-01-2011 10:16:12},{b,June-01-2011 10:17:12},{d,June-01-2011 10:18:12},{d,June-01-2011 10:25:12},{e,June-01-2011 10:26:12},{e,June-01-2011 11:38:12},{f,June-01-2011 10:39:12},{f,June-01-2011 10:43:12},{a,June-01-2011 10:44:12},{f,June-01-2011 10:51:12},{b,June-01-2011 10:51:12},{b,June-01-2011 10:53:12},{c,June-01-2011 10:54:12},{g,June-01-2011 10:55:12},{b,June-01-2011 10:56:12},{b,June-01-2011 10:57:12},{b,June-01-2011 10:58:12}
    Then I have to retrieve following rows in output : {b,June-01-2011 10:14:12},{b,June-01-2011 10:15:12},{b,June-01-2011 10:17:12},{d,June-01-2011 10:18:12},{d,June-01-2011 10:25:12},{f,June-01-2011 10:39:12},{f,June-01-2011 10:43:12},{b,June-01-2011 10:51:12},{b,June-01-2011 10:53:12},{b,June-01-2011 10:56:12},{b,June-01-2011 10:57:12},{b,June-01-2011 10:58:12}
    Is it related to data Mining? i have 3 crore rows in database table.I have to search such type of many patterns in my application.I have spent hours looking for tutorials on Google. However I cannot seem to find anything that holds the hand? try to be more clear, i'm in lack of ideas in this problem, even it sounds like a classic. Can oracle java data mining solve the problem?

    first of all thanks for reply, i will take care of your suggestion.
    Number of rows in table : More than 3*10pow7(30 Milion rows)(But it can be more than 120 milion)
    Actually i have to display all those rows which setisfy following criteria:( Specific value of column A should appear min 2 times in the interval of 10 minutes.)
    for eg.
    eg 1. {b,June-01-2011 10:14:12},{b,June-01-2011 10:15:12},{b,June-01-2011 10:17:12}{This set is appearing 3 times in the any interval of 10 minutes.}
    EG2 {a,June-01-2011 10:13:12} is present only one time,so i dont want this rows in output.
    EG# {e,June-01-2011 10:26:12},{e,June-01-2011 11:38:12} is present 2 times in db,but not in the interval of 10 minutes,so i dont want this rows as output.(t1=10:26:12,t2=11:38:12 difference is more than 10 minutes.)
    In my eg. i specified only 2 columns but in actual scenario there will be 8-10 columns in table.This is only one pattern which i specified,but there are many more pattern which i have to search in db.As specified above in eg. was only one pattern,After fulfiling this pattern It has to pass many other pattern.and i want result should be retrieved very fast.
    Please dont go into answer of above eg.Actually i want, what should be approach of such type of problems?
    Is this problem related to oracle data mining and how?
    Can data mining algorthms(Minimum Description Length ,Naive Bayes,Apriori,Decision Tree,Non-Negative Matrix Factorization ,Support Vector Machine...etc..) solve my problem?
    Different-2 type of queries will be fired against this table?
    if i am still not clear then let me know.

  • Is it possible to show the count of number or rows in table on the Home page Tab button.

    Is it possible to show the count of number or rows in table on the Home page Tab button.
    On home page there is a Tab called Count and I want to show the count on the right corner of this tab button.
    Please help

    Create an application item. APP_HOME_COUNT.
    Create an application process:
      make the application process type "on new instance" if you only want this to run once
      make it "on load before header" if you want to have the value set every page load
    application process source:
    select count(*) into APP_HOME_COUNT from <your table>
    modify the tab name to reference the app item, maybe something like "Count(&APP_HOME_COUNT.)"
    result should look like this "Count(5)"
    Good Luck,
    Tyson

  • Can we find the number of rows in table from the dump file

    Hi All,
    Can we find the number of rows in table from the dump file with out importing the table in to the database?
    Please let me know ,if any option is there.
    Thanks,
    Kumar.

    <s>Try to import with option SHOW=Y, that should skip the number of rows which are into a table from a dump file.</s><br>
    <br>
    Nicolas.<br>
    Oops, sorry, that doesn't show the number of lines...<br>
    Message was edited by: <br>
    N. Gasparotto

  • How to count number of rows in table

    can I get number of row in table except Count(*) in pl/sql
    is there any other way

    Also posted and answered here
    how to count number of rows in table
    count(*) will be the fastest way. It is only slow if the table has a vast number of rows, in which case why do you need to know the tables has 73552436467721 rows and not 73552436467737 rows. It doesn't seem to be much use. Either that or you are counting them a lot, which again seems rather pointless.

  • How to set total number of rows of table control

    Hi All,
    I want to set the total number of rows of table control. I don't want to display the blank rows in table.
    Regards,
    Shrinivas

    Need some fine tuning regarding the scrollbar height but it's a start
    Unless this isn't what you asked for
    Small number of rows
    Large number of rows
    Attachments:
    PlayingWithTable.vi ‏17 KB

  • How to add the Row count(number of rows in table)  in  the table header?

    Hi,
    I'm having a table. This table is viewed when i click on a search button.
    <b>On the table header it should dynamically display the number of rows in the table, i.e., the row count.</b>
    How to do this? could any one explain me with the detailed procedure to achieve this.
    Thanks & Regards,
    Suresh

    If you want to show a localized text in the table header, you should use the <b>Message Pool</b> to create a (parameterized) message "tableHeaderText" like "There are table entries".
    Next, create a context attribute "tableHeaderText" of type "string" and bind the "text" property of the table header Caption UI element to this attribute.
    Whenever the table data has changed (e.g. at the end of the supply function for the table's data source node), update the header text:
    int numRows = wdContext.node<TableDataSourceNode>().size();
    String text = wdComponentAPI.getTextAccessor().getText
      IMessage<ComponentName>.TABLE_HEADER_TEXT,
      new Object[] { String.valueOf(numRows) }
    wdContext.currentContextElement().setTableHeaderText(text);
    Maybe you want to provide a separate message for the case that there are no entries.
    Alternatively, you can make the attribute calculated and return the header text in the attribute getter.
    Armin

  • How to find number of rows in tables

    Hi,
    Can you please help me how to know the number of rows in all the tables databsae.
    Thanks In Advance,

    Just found out that the behaviour changed in 11.2.0.2:
    SQL> select * from v$version where rownum = 1
    BANNER                                                                         
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production         
    1 row selected.
    SQL> select owner, table_name, column_value cnt
      from (select owner, table_name, 'count(ora:view("' || owner || '","' || table_name || '"))' xq
              from all_tables
             where table_name in ('EMP', 'DEPT')),
           xmltable (xq) order by owner, table_name desc
    OWNER                          TABLE_NAME                     CNT  
    FLEET                          EMP                            14   
    FLEET                          DEPT                           4    
    MICHAEL                        EMP                            14   
    MICHAEL                        DEPT                           5    
    SCOTT                          EMP                            14   
    SCOTT                          DEPT                           4    
    STEFAN                         EMP                            14   
    STEFAN                         DEPT                           4    
    8 rows selected.

  • Deleing large number of rows from table

    Hi,
    Consider tables A,B,C,D,E,F. all are having 100000++ records Tables B,C,D are dependent on table A (with foreign key constraint). When I am deleting records from all tables, table B,C,D are taking max 30-40 seconds while table A is taking 30-40 mins. All tables are having indexes.
    Method I have used:
    1. Created Temp table
    2. then deleted all records from B,C,D,E,F for all records in temp table for limit of 500.
    delete from B where exists (select 1 from temp where b.col1=temp.col1);
    3. please suggest options for me why it is taking too much time for deleting records in table A.
    Is there any thing that during deleting data from such master table, it is reffering to all dependent tables even if dependent data is not present ??? If yes then couls you please please suggest options for me to remove this ? I hope it won't go for CHECK constraints during deleting data.
    Thanks,
    Avinash
    Edited by: user12952025 on Apr 30, 2013 2:55 AM
    Edited by: user12952025 on Apr 30, 2013 2:56 AM
    Edited by: user12952025 on Apr 30, 2013 2:57 AM

    user12952025 wrote:
    Hi,
    Consider tables A,B,C,D,E,F. all are having 100000++ records Tables B,C,D are dependent on table A (with foreign key constraint). When I am deleting records from all tables, table B,C,D are taking max 30-40 seconds while table A is taking 30-40 mins. All tables are having indexes.What attribute of the Foreign key is specified? Is it On Delete Cascade? If yes, then in a way, deleting data fro Child tables is un-necessary. Only a Delete from parent shall suffice.
    >
    Method I have used:
    1. Created Temp table
    2. then deleted all records from B,C,D,E,F for all records in temp table for limit of 500.
    delete from B where exists (select 1 from temp where b.col1=temp.col1);
    3. please suggest options for me why it is taking too much time for deleting records in table A.
    Is there any thing that during deleting data from such master table, it is reffering to all dependent tables even if dependent data is not present ??? If yes then couls you please please suggest options for me to remove this ? I hope it won't go for CHECK constraints during deleting data.One another way is to "Switch-Off" the relationship while deleting the data.
    ALTER TABLE table_name
    disable CONSTRAINT constraint_nameAnd then Delete the data from each of tables.
    You did specify the number of rows in each table, it would have been better to mention the number of rows to be deleted.
    It is not a hard-and-fast way, but would generally perform better, to copy the data (to be retained) from Parent Table into a Temporary Table, Drop Parent Table and rename teh Temporary table to parent table. Similar can be performed on Child tables.
    You may then Enable the Foreign key constraints.

  • Universe object that returns the number of rows in table?

    Is it possible to create a Universe object to support the following SQL query:
    SELECT * FROM (SELECT ROWNUM rownum1 FROM TABLE) WHERE rownum1 = (SELECT (MAX(ROWNUM)) FROM TABLE)

    Amr,
    Hey dude, welcome back, long time no hear from you.
    You were on the right track with "number of rows", but here is the correct syntax:
    =NumberOfRows([Query 1])
    Thanks,
    John

  • Restrict number of rows in table view

    Can a table view has only as many rows as the actual rows in the underlying data structure. Actually, I have a table view with less than 5 rows, but the tableview shows like 15+ rows with the rest of the rows as blank(alternative colors for each empty rows). I know there is a style which can be applied to make the remaining empty rows show with white background. However, the height of the table view doesn't reduce to show only the actual number of rows. Is there a way we can restrict the height of the table view to the height of actual rows it has?
    Thanks.

    Hi. Add a listener to your data. Use prefheight to restrict the table height:
            table.setPrefHeight(data.size() * 25 + 25);  
            data.addListener(new ListChangeListener<Person> ()  {
                public void onChanged(ListChangeListener.Change<? extends Person> c) {
                   table.setPrefHeight(data.size() * 25 + 25);
            });It works only when data.size() * 25 + 25 < scene.height

  • Count number of rows in table

    Hi!
    1. How can you through ABAP and select statements count the number of rows in one table?
    2. I want to read all rows from one table to an internal table. Can this be done dynamically or do I first have to count the number of rows in the table and then declare an internal table with the number of rows counted.
    regards
    Baran

    HI,
    No you don't have to count number of rows first, Internal table size will increase dynamically. you have to declare this with initial size like this.
    <b>data: itab type standard table of bkpf initial size 0.
    SELECT * FROM bkpf into table itab.</b>
    All values from bkpf will be inserted into table internal table itab.
    Regards,

  • Increase number of rows in table control dynamically

    Hi,
    How can I increase the number of rows in a table control dynamically.If i have placed a table control in the screen painter with 5 rows, how can I increase the length to 10 dynamically in the coding.Kindly advice..
    Best Regards,
    Ashwini

    Hi aswini,
    where did you tell the system to have only 5 rows.
    i dont think such an option of specifying the number of rows is possible.
    as i reconfirmed the screen painter just now.
    please let me know if possible.
    try this.
    in PBO.
    describe table itab lines tc-lines.
    if tc-lines is initial.
    tc-lines = 5.
    else.
    tc-lines = 10.
    endif.
    hope this will serve your purpose.
    thanks and regards
    Ramchander Rao.Krish
    Edited by: ramchander krishnamraju on Nov 19, 2008 11:52 AM

  • Result Set - How to retrieve the number of rows in resultset

    harlo....everyone.
    i m new in this language and would like to ask that how can i store the result into an array or u all hav others ideal to do it......? Hopefully can get answer asap....thanksssss.
    Below is the source code that i did. Please comment it
    ResultSet rs = stmt.executeQuery("Select CCourse_Code from RegisteredCourse, Student where Student.NStud_ID ='123'and Student.CStud_Pwd='123' and Student.NStud_ID = RegisteredCourse.NStud_ID ");
    if(rs!=null){
    // can i get the the number of records in resultset, rs to define my array size
    String course[] = new String[2];
    while(rs.next()){
    for(int i =0; i<course.length; i++)
    course[i] = rs.getString("ccourse_code");
    return course;

    Or...
    ResultSet rs = stmt.executeQuery("Select count(CCourse_Code) from RegisteredCourse, Student where Student.NStud_ID ='123'and Student.CStud_Pwd='123' and Student.NStud_ID = RegisteredCourse.NStud_ID ");
    This should return a table with one row and one column. This will hold the number originally requested.
    However I would still go with the ArrayList suggestion given above.

  • Searchin pattern in datbase table.(Number of rows in table :More than70Lac)

    Actually i have a db table having 2 columns(columnA,time).db table has 70lac rows.I have to retireve all those values which are present min. 2 times in the interval of 10 minutes. eg. columnA,time values are
    {a,June-01-2011 10:13:12},{b,June-01-2011 10:14:12},{b,June-01-2011 10:15:12},{c,June-01-2011 10:16:12},{b,June-01-2011 10:17:12},{d,June-01-2011 10:18:12},{d,June-01-2011 10:25:12},{e,June-01-2011 10:26:12},{e,June-01-2011 11:38:12},{f,June-01-2011 10:39:12},{f,June-01-2011 10:43:12},{a,June-01-2011 10:44:12},{f,June-01-2011 10:51:12},{b,June-01-2011 10:51:12},{b,June-01-2011 10:53:12},{c,June-01-2011 10:54:12},{g,June-01-2011 10:55:12},{b,June-01-2011 10:56:12},{b,June-01-2011 10:57:12},{b,June-01-2011 10:58:12}
    Then I have to retrieve following rows in output : {b,June-01-2011 10:14:12},{b,June-01-2011 10:15:12},{b,June-01-2011 10:17:12},{d,June-01-2011 10:18:12},{d,June-01-2011 10:25:12},{f,June-01-2011 10:39:12},{f,June-01-2011 10:43:12},{b,June-01-2011 10:51:12},{b,June-01-2011 10:53:12},{b,June-01-2011 10:56:12},{b,June-01-2011 10:57:12},{b,June-01-2011 10:58:12}
    Is it related to data Mining? i have 70 lac rows in database table.I have to search such type of many patterns in my application.I have spent hours looking for tutorials on Google. However I cannot seem to find anything that holds the hand? try to be more clear, i'm in lack of ideas in this problem, even it sounds like a classic. Can java data mining solve the problem?

    Hi,
    Sorry but this does not look like a data mining problem at all.
    Thanks, Mark

Maybe you are looking for

  • How do I deactivate online (needed when computer fails)?

    Problem: When a computer fails with Adobe products installed, it is always a problem to do deactivation of license keys. When I login to my account at adobe.com, I can see my licenses.  I would have expected that I could manage my activations there. 

  • How can I identify and delete duplicates on the latest version of itunes?

    How can I identify and delete duplicates on the lastest version of iTunes?

  • IPad to iPhone itabs not working

    I have just got the new ipad mini with retina display I restored my stuff from a iPhone 5 icloud back up my emails music calendar iMessage etc sync but I can't get icloud tabs to work at all on any device (iPhone 5 to ipad mini with retina display) t

  • How to get Business Partner Number from Position Code

    Please help me in determining the Business Partner assigned to a particular position in the Organizational Structure. Short code of the position is available in table HRP1000 field SHORT. Thanks in advance

  • 11.2 Single Instance DB with ASM

    DB version:11.2.0.2 OS : RHEL 5 I want to create a single instance DB with ASM. I did a software only installation . In DBCA , i can't find an option to create Diskgroup through UI like we have in 10.2's DBCA. I will have to use ASMCA for this. But i