How can I get the number of rows in my sql result, without a loop?

Hello,
I've a problem, I would like to get the number of rows in my sql result without make a loop like :
while (rs.next()){
int number = rs.getRow();
Is there any method to do this, on the first element?
Thx, STeF

If you want to count how many rows are in result set, I dont think you can, but you could always run a count statement for that sql
say your sql is
select field1, field2, field3
from table1, table2
where field4=field5 ......
then you can count the rows this statement returns by
select count(*) from
(say your sql is
select field1, field2, field3
from table1, table2
where field4=field5 ......)
This way you will get the count for just that sql

Similar Messages

  • Urgent******how can i get the number of rows enterd by the user in a table

    Hi Frndz..
    As per my requirement i need to do the validations for the multipple rows in a table that was enterd by the user,
                   T
              The prob is how can i get that number of rows that enterd by user,
           WDMessageManager msg = wdComponentAPI.getMessageManager();
         String col1= "";
         String col2= "";
         double col3= 0;
         double col4= 0;
         double amount= 0;
         int nodesize = wdContext.nodeTest().size();
         try
         for(int i=0; i<=2 ; i++)
                   col1 = wdContext.nodeTest().getTestElementAt(i).getCol1();
                 //msg.reportSuccess("col1 size is :"+col1);
                   col2 = wdContext.nodeTest().getTestElementAt(i).getCol2();
                   col3 = wdContext.nodeTest().getTestElementAt(i).getCol3();
                   col4 = wdContext.nodeTest().getTestElementAt(i).getCol4();
                    amount = wdContext.nodeTest().getTestElementAt(i).getAmount();
              if(col1 == "" )
                        msg.reportException("Plz fil the col1 for line:",true);
                   break;
              else
              if(col2 == "" )
                                  msg.reportException("Plz fil the col2 for line:",true);
                             break;
                        else
              if(col3 <= 0)
                   msg.reportException("Plz fil the col3:",true);
                   break;
              else
                   if(col4 <= 0)
                   msg.reportException("Plz fil the col4:",true);
                   break;
              msg.reportSuccess("skvgjhdfgasdfgsjkafguisafisenvtvyeriy");
                                                       wdThis.test();
         catch (Exception e)
                   msg.reportException("strMessage in catch block",true);
         this is the code am going
    Regards
    Rajesh

    Hi,
       You can try this:
    * Let's say the table's datasource is a node called Table  and it has two attributes first & second.
    * You want to check if any of these attributes has been changed by the user or not. If they have been
    * changed then you want to do some validations against them.
      int sizeOfTable = wdContext.nodeTable().size();
      for(int i = 0; i < sizeOfTable; i++){
         IPrivate<view name>.ITableElement ele = wdContext.nodeTable().getTableElementAt(i);
         if(ele.isChangedByClient(ITableElement.<attribute name>)){
            //value has been changed, do some validation. You can get the row index using ele.index().
    Regards,
    Satyajit.

  • How can I limit the number of rows returned by a select stat

    How can I limit the number of rows returned by a select
    statement. I have a query where I return the number of stores
    that are located in a given area.. I only want to return the
    first twenty-five stores. In some instances there may be over
    200 stores in a given location.
    I know is SQL 7 that I can set the pagesize to be 25....
    Anything similiar in Oracle 8i?
    null

    Debbie (guest) wrote:
    : Chad Nale (guest) wrote:
    : : How can I limit the number of rows returned by a select
    : : statement. I have a query where I return the number of
    : stores
    : : that are located in a given area.. I only want to return the
    : : first twenty-five stores. In some instances there may be
    : over
    : : 200 stores in a given location.
    : : I know is SQL 7 that I can set the pagesize to be 25....
    : : Anything similiar in Oracle 8i?
    : If you are in Sql*Plus, you could add the statement
    : WHERE rownum <= 25
    : Used together with an appropriate ORDER BY you
    : could get the first 25 stores.
    Watch out. ROWNUM is run before ORDER BY so this would only
    order the 25 selected
    null

  • How can I get the number of missed messages to pop up on my message icon like the would if i missed a call

    How can I get the number of missed messages to pop up on my message icon like the would if i missed a call

    Hi,
    Go to Settings>Notifications Center>Messages, and make sure the Badge App Icon is turned ON.
    Cheers,
    GB

  • How can i now the number of rows afected by the last query?

    how can i now the number of rows afected by the last query?
    For example:
    i made this update :
    update trl_trial set status = 1 /* Validation */
    where trial_id = cobject_id
    and status = 0; /* Initial */
    if NUMBERS_OF_ROWS = 0 then
    end if;
    how can i do this?
    thank u!!!!

    how can i now the number of rows afected by the last query?
    For example:
    i made this update :
    update trl_trial set status = 1 /* Validation */
    where trial_id = cobject_id
    and status = 0; /* Initial */
    if NUMBERS_OF_ROWS = 0 then
    end if;
    how can i do this?
    thank u!!!! Do the following :
    update trl_trial set status = 1 /* Validation */
    where trial_id = cobject_id
    and status = 0; /* Initial */
    if(SQL%ROWCOUNT = 0 ) then
    else
    end if;
    you can also declare a variable and do
    myvar := SQL%ROWCOUNT;
    SQL%ROWCOUNT returna the # of rows afected by any sql
    statement, like DELETE, UPDATE

  • How can I get the photos on my pc onto my Macbook without emailing each one individually to myself?

    How can I get the photos on my pc onto my Macbook without emailing each one individually to myself?

    Welcome to Apple Support Communities.
    Copy them from your PC to a flash drive or an external drive, then open iPhoto and select Import to Library.
    Depending on your settings, iPhoto might open automatically and ask if you want to import them when the device (camera or flash drive or external drive) containing the images is connected.
    At the end of the import, iPhoto will ask if you want to delete or keep the photos on the other device. Keep until you're absolutely certain all images are imported correctly and you've viewed them in iPhoto. It's always nice to have a backup.

  • How can I get the number request's (count) for One interface

    Hi Guru's,
    I have a requirement,One interface say Hello world._How can I get the number request's (count) for this interface_.I thing with BAM it's possible.
    But I have no idea about BAM.If is there any alternative please give directions and instruction how to achieve this task.
    Can any body help.Thanks in advance.
    Regards
    Mani

    You have to query the SOA_INFRA schema to get the answer.
    Build a select query in cube_instance table.
    Thanks,
    Vijay

  • I Have an older IPod Mini that was synced to a computer I no longer have. How can I get the song on it to a new Library without losing the songs

    I have an older IPod Mini that was synced to a computer I no longer have. How can I move the songs on it to a newer library without losing the songs?

    iOS: Unable to update or restore

  • How can I limit the number of rows in Oracle?

    Hi All,
    I am using very complex query where I join 6 table to fetch data from database.
    I have requirement like fetching a first 10000 row and then fetching another records after 10000 and so on.
    I just want to know how to fetch a limited number of rows using sql query. Moreover, I also want to know how to calculate the total number of row (alternative of count method because I don't want to query the database twice because its affect the performance).
    Thanks in advance.
    Regards,
    Sunny

    sunny@oimnewbie wrote:
    Hi All,
    I am using very complex query where I join 6 table to fetch data from database.
    I have requirement like fetching a first 10000 row and then fetching another records after 10000 and so on.
    I just want to know how to fetch a limited number of rows using sql query. Moreover, I also want to know how to calculate the total number of row (alternative of count method because I don't want to query the database twice because its affect the performance).
    Thanks in advance.
    Regards,
    SunnyThis smells like a very fishy requirement based on a fundamental misunderstanding of how Oracle works. Could you explain why you want to arbitrarily limit the result set to 1000 rows? What will happen between that and getting the "next" 1000? What triggers getting the "next" 1000? and how do you define "next", since there is no ordering in a heap table.
    I suspect we can make that requirement go away be presenting a better approach to the real issue.

  • How can I get the number pad to work (input characters) on my new plugin Mac full keyboard when connecrted to my mackbook?

    The number pad on by Mac USB keyboard does not work (no input).  I have updated the Mac keyboard drivers and that did fix the problem.  How can I get this keyboard to work when connected to my Powerbook?

    Do you have "Mouse Keys turned on in System Preferences / Universal Access ?
    Mouse Keys     Turn on to use the keyboard instead of the mouse to control your computer

  • How can I get the number of computers that a specific user had add to domain?

    Greetings
    In Win Srv 2K8 I know how to increase\decrease the total number of computers that any user can add to domain.
    (http://support.microsoft.com/kb/243327/en-us)
    but there is any way to get the number of computer accounts that a user had add?
    thank you in advance

    Hi,
    Regarding your request, maybe we could use the 'ms-DS-CreatorSID' attribute to verify the computer number that a specific has joined to the domain. Please understand that for a
    computer account created by domain users, the account has 'ms-DS-CreatorSID' attribute to indicate the creator user. When a user adds a computer to the domain, a process enumerates the 'ms-DS-CreatorSID' attribute on every computer account in the domain and
    calculates if the sum exceeds the current quota for that user.
    The 'ms-DS-CreatorSID' and 'ms-DS-MachineAccountQuota' with default value 10 are also available in Windows Server 2008 AD DS.
    Note: The 'ms-DS-CreatorSID' attribute will be unset in the computer account that is pre-created in Active Directory Users and Computers MMC or joined by domain administrators.
    Auditing on the computers container should work for collecting information of joining computer into the domain.
    For details, please refer to the following similar thread.
    How to find computers joined by an user (ms-ds-creatorsid) using powershell
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/68db87d8-0890-4d23-af9f-4693ccc1074d/how-to-find-computers-joined-by-an-user-msdscreatorsid-using-powershell?forum=winserverpowershell
    Regards,
    Andy Qi
    Andy Qi
    TechNet Community Support

  • How do I get the number of rows in a ResultSet?

    I checked the API, but didn't find a method that does this.

    You could try calling last() then getRow() to get the
    no of rows ...You probably need a scrollable resultset to do this, so that you can
    rewind back to the start and read the data in.
    I imagine you want to get a count, to size an array, before reading in the data ? Why not load it in an arraylist, then convert to an array afterwards ?
    regards,
    Owen

  • How can I get the number of distinct records that each field of a DB table has?

    Hi everyone,
    I would like to know how to get he number of distinct records that each field of a DB table has. When tracing a SQL statement either in ST12 or ST05, in the plan execution, if the sentence made useage of an index, then I can click in the index name and see this kind of information (no. of distinct values for each field of that index).
    Can I do something like this but with the whole fields of a table?
    What I have found until now is in Tx ST10; I search for whatever kind of table statistics and then use the function of "Analyze table" (which takes me to Tx DB05). In here, I can enter a table and up to 5 fields in order to get the information that I want.
    Is there any other way to do this?
    Regards,
    David Reza

    Hi David,
    You can export the same to excel and sort as per requirement.
    Sorry is that what you are looking for ?
    Regards,
    Deepanshu Sharma

  • How do i get the number of rows in Resultset?

    Hi,
    Is there a way to make the size of string array according to the number of records
    from the Resultset? The other problem is the values in saRow are all null.Why is it so? Thanks for helping me in advance
    String sql = "SELECT Name FROM UserType" ; << Return "Admin" "User" "CIO"
    ResultSet rs = db.ExecuteSQL(sql);
         while (rs.next()) {
         int i=0,rowCount;
         String[] saRow = new String[2]; << supposed to use rowCount
         saRow[i++] = rs.getString("Name");
         System.out.println(saRow);
    //System.out.println
    Database Query Success
    null << saRow value
    null
    null
    null
    null
    null

    Essentially, you can't. A ResultSet is not a set of rows in memory: it is a cponnection to a back end database. Potentially, you start getting results out of the result set while the database is still searching for more.
    I see this all the time on these forums: people doing work in java that is better done on the database. If you want to know the number of records in the database, ask the database: "select count(*) from UserType". Especially once you start needing to search big tables.
    However, in this case, where you are just loading up the types: why bother? You know that there wioll only be a few of them. Load the results into an ArrayList. Go to the JavaDocs that you downloaded with the JDK, go to the "guides" section, and see the guide on the collections API.

  • How can I get the number of pages of a report?

    Hello to everyone, I'm writing a small app that exports a report to PDF (the app is done and everything is ok).
    Along with the PDF I need to create an XML file that describes the PDF file properties. One of the properties I need to supply is the number of pages of the PDF file. How can I ask Crystal Reports SDK for the number of pages my ReportDocument is made of?
    Best regards
    Alessandro

    Hello Alessandro,
    I found a Business Objects Note with a possible solution.  You can search for Notes yourself by starting at the Business Objects area of this SAP Community Network (SCN) site.
    Go to the [Business Objects link|https://www.sdn.sap.com/irj/boc] in the menu bar on SCN.
    Then go to the [Support link|https://www.sdn.sap.com/irj/boc/businessobjects-support] in the sub menu for Business Objects.
    Now go to the [Business Objects Note link|https://www.sdn.sap.com/irj/boc/businessobjects-notes] in the left side navigation menu.
    Finally, click on the [Search Business Objects Notes link|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_ossnotes&query=&adv=true] in the middle of the page.
    From the Notes Search page click on the Advanced Search link.  For your question I searched on these terms - net page number - and added "boj" (without the quotes) in the Component field for Advanced Search.  The "boj" component helps limit the search to Business Objects components - like the Crystal Reports .NET SDK.
    This search brought up a number of results.  The second result looks like it will address your question:
    "[SAP Note 1216240|https://bcp.wdf.sap.corp/sap/sapnotes/display/0001216240] - How to retrieve the number of pages from a ReportDocument in VS .NET"
    I hope this helps!
    Sincerely,
    Dan Kelleher

Maybe you are looking for

  • Desktop Sync No Longer Works

    Thank you for reading and for any input you are willing to offer. I have Windows 7 Professional. My Outlook profile is saved on an Exchange server and my Blackberry had previously beeng syncing with Outlook in this setup for nearly a year without is

  • Running 10.8 drivers on 10.7

    Hello there, We have a Mini Server running OSX 10.8 and 25 iMacs running on 10.7 that are all bound through Windows AD and OpenDirectory. We have purchased a printer that has both 10.7 and 10.8 drivers available, I installed the printer to the server

  • Copying a DVD on an new iMac

    First, forgive me for sounding like a complete novice. I recently purchased (Christmas 09) an iMac with the latest version of snow leopard, iLife, iWorks, etc.(was a PC user for last 15 years). My son has a DVD that was made for him by another parent

  • Open items of all company codes displaying in vendor or customer payment

    Hi I am doing the open item posting for vendors with F-53, But it is showing all the open items of the Extended  vendor in the other company codes. I want to only display one company code open items. Please suggest me how to remove that option. I am

  • Can't get username and password into client proxy

    Hello all, I am creating a client proxy using class xem_measurementImport (the doMeasurementImport method). I call this from an ABAP program, and it pushes measurement data into the EC (Environmental Compliance) system, which runs in Java.  Everythin