Give me a way to count the number of entries in a  Database Table

Hello All,
I am writing a code to determine the number of  entries in a SAP/Custom table.
Can you please suggest a proper approach and a good query.
Thanks in advance.

Hi,
If you want to do it in a more generic way you can do the following:
DATA: tblname(50),
      tp_rows TYPE i.
tblname = 'MARA'.
SELECT COUNT(*)
FROM (tblname)
INTO tp_rows.
IF sy-subrc <> 0.
  CLEAR tp_rows.
ENDIF.
At runtime the table is being determined and in this case it's set to MARA. The value of the number of rows is in the variable tp_rows.
Best regards,
Guido Koopmann

Similar Messages

  • A quick way to count the number of  newlines '/n' in string of 200 chars

    I am trying to establish the number of lines that a string will generate.
    I can do this by counting the number of '/n' in the string. However my brute force method (shown below) is very slow.
    Normally this would not be a problem on a 2800mhz Athlon (Standard) PC this takes < 1 second. However this code resides within a speed critical loop (not shown). The code shown below is a Achilles heal as far as the performance of this speed critical loop goes.
    Can anyone suggest a faster way to count the number of �/n� (new lines) within a text string of around 50- 1000 chars, given that there may be 10 � 100 newline chars. Speed is a very important factor for this part of my program.
    Thanks in advance
    Andrew.
        int lineCount =0;
        String txt = this.getText();
        //loop throught text and count the carridge returns
        for (int i = 0; i < txt.length(); i++)
          char ch = txt.charAt(i);
          if (ch == '\n')
           lineCount ++;
        }//end forMessage was edited by:
    scottie_uk
    Message was edited by:
    scottie_uk

    Well, here is a C version. On my computer the Java version (reply 9 above) is slightly faster than C. YMMV. For stuff like this a compiler can be hard to beat even with assembler, as you need to do manual loop unrolling and method inlining which turn assembly into a maintenance nightmare.
    // gcc -O6 -fomit-frame-pointer -funroll-loops -finline -o newlines.exe newlines.c
    #include <stdio.h>
    #include <string.h>
    #if defined(__GNUC__) || defined(__unix__)
    #include <time.h>
    #include <sys/time.h>
    #else
    #include <windows.h>
    #endif
    #if defined(__GNUC__) || defined(__unix__)
    typedef struct timeval TIMESTAMP;
    void currentTime(struct timeval *time)
        gettimeofday(time, NULL);
    int milliseconds(struct timeval *start, struct timeval *end)
        int usec = (end->tv_sec - start->tv_sec) * 1000000 +
         end->tv_usec - start->tv_usec;
        return (usec + 500) / 1000;
    #else
    typedef FILETIME TIMESTAMP;
    void currentTime(FILETIME *time)
        GetSystemTimeAsFileTime(time);
    int milliseconds(FILETIME *start, FILETIME *end)
        int usec = (end->dwHighDateTime - start->dwHighDateTime) * 1000000L +
         end->dwLowDateTime - start->dwLowDateTime;
        return (usec + 500) / 1000;
    #endif
    static int count(register char *txt)
        register int count = 0;
        register int c;
        while (c = *txt++)
         if (c == '\n')
             count++;
        return count;
    static void doit(char *str)
        TIMESTAMP start, end;
        long time;
        register int n;
        int total = 0;
        currentTime(&start);
        for (n = 0; n < 1000000; n++)
         total += count(str);
        currentTime(&end);
        time = milliseconds(&start, &end);
        total *= 4;
        printf("time %ld, total %d\n", time, total);
        fflush(stdout);
    int main(int argc, char **argv)
        char buf[1024];
        int n;
        for (n = 0; n < 256 / 4; n++)
         strcat(buf, "abc\n");
        for (n = 0; n < 5; n++)
         doit(buf);
    }

  • Fastest way to count the number of occurences of string in file

    I have an application that will process a number of records in a plain text file, and the processing takes a long time. Therefore, I'd like to first calculate the number of records in the file so that I can display a progress dialog to the user (e.g. " 1234 out of 5678 records processed"). The records are separated by the string "//" followed by a newline, so all I need to do to get the number of records is to count the number of times that '//' occurs in the file. What's the quickest way to do this? On a test file of ~1.5 Gb with ~500 000 records, grep manages under 5 seconds, whereas a naive Java approach:
    BufferedReader bout = new BufferedReader (new FileReader (sourcefile));
                   String ffline = null;
                   int lcnt = 0;
                   int searchCount = 0;
                   while ((ffline = bout.readLine()) != null) {
                        lcnt++;
                        for(int searchIndex=0;searchIndex<ffline.length();) {
                             int index=ffline.indexOf(searchFor,searchIndex);
                             if(index!=-1) {
                                  //System.out.println("Line number " + lcnt);
                                  searchCount++;
                                  searchIndex+=index+searchLength;
                             } else {
                                  break;
                   }takes about 10 times as long:
    martin@martin-laptop:~$ time grep -c '//' Desktop/moresequences.gb
    544064
    real     0m4.449s
    user     0m3.880s
    sys     0m0.544s
    martin@martin-laptop:~$ time java WordCounter Desktop/moresequences.gb
    SearchCount = 544064
    real     0m42.719s
    user     0m40.843s
    sys     0m1.232sI suspect that dealing with the file as a whole, rather than line-by-line, might be quicker, based on previous experience with Perl.

    Reading lines is very slow. If your file has single byte character encoding then use something like the KMP algorithm on an BufferedInputStream to find the byte sequence of "//\n".getBytes(). If the file has a multi-byte encoding then use the KMP algorithm on a BufferedReader to find the chars "//\n".getCharacters() .
    The basis for this can be found in reply #12 of http://forum.java.sun.com/thread.jspa?threadID=769325&messageID=4386201 .
    Edited by: sabre150 on May 2, 2008 2:10 PM

  • Is there a way to count the number of times an array moves from positive to negative?

    I have an array of values, and I need to find the number of times that the array changes signs (from positive to negative, or vice versa). In other words from a graphical standpoint, how many times a certain line crosses the x-axis. Counting the number of times the array equals zero does not help however, because the array does not always equal exactly zero when it crosses the axis (ie, the points could move from .1 to -.1).
    Thanks for you help. Feel free to email me at [email protected] I only have lv 5.1.1 so if you attach any files, they cannot be version 6.0.

    Attached is a VI showing the # of Pos and Neg numbers in an array, with 0 considered as non-Pos. It is easily modifiable to other parameters - including using the X-axis value as your compare point versus only Zero.
    This is a modified VI from LV (Separate Array.vi)
    Compare this with your other responses to find the best fit.
    Doug
    Attachments:
    arraysizesposneg.vi ‏40 KB

  • Is there an easy way to count the number of albums I have in my library?

    Hi, there is probably a very easy way to find out how many albums I have in my iTunes library - but I haven't discovered it yet! (looking for something a bit like word count in MS Word document?)
    Powerbook G4 15 1.67   Mac OS X (10.4.3)   my first Mac - where have I been!?!

    Click on the Library icon in the source list Go Edit->Show Browser.
    This will split the library window into subwindows listing each genre, artist and album, at the top of these windows it will show the total for each of these categories.
    Apart from being the easiest way to count your albums, it's also a really useful way to view the library or any playlist. You can turn off the genre subwindow through the general preferences.
    Hope that helps!
    Sara.

  • How to count and display the number of records in a database table

    My webpage has a list of items and their details, every item has a button
    Read / Make comments that loads the item in its own page displaying
    a comments form and previous comments.
    This is all working fine.
    I would like to add to each item information stating how many comments have
    been made about that item.
    Allowing the user to see before hand if it is worth while clicking on the
    Read / Make comments button.
    Ideally each item will have a different number of comments.
    The problem I have is outputing the number of comments associated with each item.
    My comments table is called guest my items table is called titles.
    I'm sure mysql statement is correct -
    The table guest currently has 7 comments,
    Item 1 has 3 comments
    Item 2 has 2 comments
    Item 3 has 1 comment
    Item 4 has 1 comment
    When I test the query in dreamweaver
    $Recordset1 = "SELECT COUNT(guest.software_id) as COUNT, titles.id FROM titles LEFT JOIN guest ON titles.id = guest.software_id GROUP BY guest.software_id";
    the outoput is a list showing 2, 3, 1, 1
    My problem is, getting the totals into my repeat region.
    I tried the following line
    <td align="left" valign="top" bgcolor="#e5f8cb">Current comments:<?php echo $row_Recordset1['COUNT']; ?></td>
    resulting in all comments so far displaying 0
    I have highlighted in bold the parts that I am having difficulty with.
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $colname_rsTitles = "-1";
    if (isset($_GET['id'])) {
      $colname_rsTitles = $_GET['id'];
    mysql_select_db($database_abe, $abe);
    $query_rsTitles = sprintf("SELECT title, company, `description`, resources, location, url, image, keyword, copies FROM titles WHERE id = %s ORDER BY id ASC", GetSQLValueString($colname_rsTitles, "int"));
    $rsTitles = mysql_query($query_rsTitles, $abe) or die(mysql_error());
    $row_rsTitles = mysql_fetch_assoc($rsTitles);
    $totalRows_rsTitles = "-1";
    if (isset($_GET['id'])) {
      $totalRows_rsTitles = $_GET['id'];
    $colname_rsTitles = "-1";
    mysql_select_db($database_abe, $abe);
    $query_rsTitles = sprintf("SELECT title, company, `description`, resources, location, url, image, keyword, copies FROM titles WHERE id = %s ORDER BY id ASC", GetSQLValueString($colname_rsTitles, "int"));
    $rsTitles = mysql_query($query_rsTitles, $abe) or die(mysql_error());
    $row_rsTitles = mysql_fetch_assoc($rsTitles);
    $totalRows_rsTitles = mysql_num_rows($rsTitles);
    mysql_select_db($database_abe, $abe);
    $query_rs_comments = "SELECT * FROM guest";
    $rs_comments = mysql_query($query_rs_comments, $abe) or die(mysql_error());
    $row_rs_comments = mysql_fetch_assoc($rs_comments);
    $totalRows_rs_comments = mysql_num_rows($rs_comments);
    mysql_select_db($database_abe, $abe);
    $query_rs_users = "SELECT * FROM users";
    $rs_users = mysql_query($query_rs_users, $abe) or die(mysql_error());
    $row_rs_users = mysql_fetch_assoc($rs_users);
    $totalRows_rs_users = mysql_num_rows($rs_users);
    mysql_select_db($database_abe, $abe);
    $query_Recordset1 = "SELECT COUNT(guest.software_id) as COUNT, titles.id FROM titles LEFT JOIN guest ON titles.id = guest.software_id GROUP BY guest.software_id";
    $Recordset1 = mysql_query($query_Recordset1, $abe) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    mysql_select_db($database_abe, $abe);
    if(!isset($_POST['softwareLevel'])){
    if (!isset($_GET['class_id'])) {
    //show all software titles
    $query_rsTitles = "SELECT id, title, company, `description`, resources, location, url, image, keyword, copies FROM titles ORDER BY id ASC";
    }else{
    //show software titles filtered by Literacy of Numeracy (using URL GET variable)
    $query_rsTitles = "SELECT id, title, company, `description`, resources, location, url, image, keyword, copies FROM titles WHERE titles.class_id = ". GetSQLValueString($_GET['class_id'], "int") ." ORDER BY id ASC";
    }else{
    //show software titles filtered by Level (using Form POST variable)
    $query_rsTitles = "SELECT id, title, company, `description`, resources, location, url, image, keyword, copies FROM titles WHERE titles.level_id = ". GetSQLValueString($_POST['softwareLevel'], "int") ." ORDER BY id ASC";
    $rsTitles = mysql_query($query_rsTitles, $abe) or die(mysql_error());
    $row_rsTitles = mysql_fetch_assoc($rsTitles);
    $totalRows_rsTitles = mysql_num_rows($rsTitles);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <?php $pagetitle="ABE Software Locator"?>
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title><?php echo $pagetitle ?></title>
    <link rel="stylesheet" href="../../includes/styles.css" type="text/css" media="screen" />
    <style type="text/css">
    body {
    background-color: #FFF;
    </style>
    </head>
    <body>
    <?php include("../../includes/header.php"); ?>
        <div><table width="70%" border="0" align="center" cellpadding="3" cellspacing="0">
      <tr>
        <td width="29%" height="50" align="center"><a href="software_detail.php">Back to Locator</a></td>
        <td width="50%" align="center"><a href="../../index.php">Welcome Page</a></td>
        <td width="21%" align="center"><a href="../../logout.php">Log Out</a></td>
      </tr>
      <tr>
        <td colspan="3" align="center"><strong> There Are <span class="totalrecordsnumber"><?php echo $totalRows_rsTitles ?></span>  Software Titles Listed</strong></td>
      </tr>
      <tr>
        <td> </td>
        <td> </td>
        <td> </td>
      </tr>
    </table>
        <?php do { ?>
          <table width="820" border="0" align="center" cellpadding="3" cellspacing="2">
            <tr>
              <td width="206" height="200" rowspan="3" align="center" bgcolor="#FFFFFF"><img src="images/<?php echo $row_rsTitles['image']; ?>" alt="<?php echo $row_rsTitles['title']; ?>" /></td>
              <td colspan="3" align="center" bgcolor="#086b50"><h2><?php echo $row_rsTitles['title']; ?></h2></td>
            </tr>
            <tr>
              <td colspan="3" align="center" bgcolor="#f6b824"><strong>Made by:</strong> <?php echo $row_rsTitles['company']; ?></td>
            </tr>
            <tr>
              <td colspan="3" align="left" valign="top" bgcolor="#e5f8cb"><p class="ptaglineheight"><strong>Description: </strong><?php echo $row_rsTitles['description']; ?></p></td>
            </tr>
            <tr>
              <td colspan="2" align="left" valign="top" bgcolor="#e5f8cb"><span class="tabletext"><strong>Keywords</strong></span><strong>: </strong><?php echo $row_rsTitles['keyword']; ?></td>
              <td colspan="2" align="left" valign="top" bgcolor="#e5f8cb"><strong>Resources:</strong> <?php echo $row_rsTitles['resources']; ?></td>
            </tr>
            <tr>
              <td colspan="4" align="left" valign="top" bgcolor="#e5f8cb"><strong>Web Address:</strong> <a href="<?php echo $row_rsTitles['url']; ?>" target="_blank"><?php echo $row_rsTitles['url']; ?></a></td>
            </tr>
            <tr>
              <td colspan="3" align="left" valign="top" bgcolor="#e5f8cb"><strong>Is installed on:</strong> <?php echo $row_rsTitles['location']; ?></td>
              <td width="195" align="left" valign="top" bgcolor="#e5f8cb"><strong>Copies available:</strong><?php echo $row_rsTitles['copies']; ?></td>
            </tr>
            <tr>
              <td colspan="3" align="left" valign="top" bgcolor="#e5f8cb"><a href="fulltitle.php?software_id=<?php echo $row_rsTitles['id']; ?>&amp;id=<?php echo $row_rsTitles['id']; ?>">Read / Make Comments About This Software</a></td>
              <td align="left" valign="top" bgcolor="#e5f8cb">Current comments:<?php echo $row_Recordset1['COUNT']; ?></td>
            </tr>
          </table> 
          <br />
          <?php } while ($row_rsTitles = mysql_fetch_assoc($rsTitles)); ?>
        </div>
        <?php include("../../includes/footer.php"); ?>
    </body>
    </html>
    <?php
    mysql_free_result($rsTitles);
    mysql_free_result($rs_comments);
    mysql_free_result($rs_users);
    mysql_free_result($Recordset1);

    I changed the mysql as you suggested GROUP BY titles.id
    and added a while loop to iterate over the data
    mysql_select_db($database_abe, $abe);
    $query_Recordset1 = "SELECT COUNT(guest.software_id) as COUNT, titles.id FROM titles LEFT JOIN guest ON titles.id = guest.software_id GROUP BY titles.id";
    $Recordset1 = mysql_query($query_Recordset1, $abe) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    $row_Recordset1 = mysql_query($query_Recordset1) or die(mysql_error());
    <td>Current comments:<?php
    if($row_Recordset1)
    while($row = mysql_fetch_array($row_Recordset1))
    echo $row['COUNT'];
    } ?></td>
    The first item now displays the following,
    comments:2311000000000000000000000000000
    all others
    comments:
    the number matched the database table exactly, 30 records 4 of which have 2, 3, 1, 1 comments.
    It looks as if the problem is trying to get the repeat region to pick up on it!

  • Is there a way to count the number of chars in a formatted text box?

    I have a formatted text box in my web dynpro for comments pertaining to workflow.
    in the backend, this is mapped to a char200 field.
    is there a way to have a running counter to let the user know how many chars are left? I'm not sure if there's an event to use for that.
    thanks,
    robert.

    Hello Robert,
    There is no way to get a running total of characters typed by the user - if you really need this functionality - consider creating an Adobe Flash Island.
    There was in the last year another thread which covered pretty much the same theme - it could be worth looking at that - although you will find that the eventual solution is the same as I suggest above.

  • Count the number of entries per calendar

    Wondering if there is any way to know how many entries I have in a specific calendar.
    Would like to be able to delete the empty ones.
    Thanks!

    Try this in Script Editor:
    AK
    click here to open this script in your editor<pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:400px">tell application "iCal"
    repeat with ThisCal in calendars
    set EventCount to count of events of ThisCal
    set ToDoCount to count of todos of ThisCal
    display dialog (name of ThisCal & " - Events:  " & EventCount & "  ToDos:  " & ToDoCount)
    end repeat
    end tell</pre>

  • Count the number of rows resulting from a select statement

    Hi,
    Is there any way of counting the number of rows resulting from a select statement. i.e I have a select distinct statement and I then want to perform an IF statement on the number of rows resulting from the select statement.
    Any help appreciated
    Thanks
    Gary

    Declare
    var1 number;
    Begin
    select count(distinct column_name) into
    var1 from table_name;
    If var1 > x Then
    End IF;
    End;
    Hope I understood the problem correctly
    null

  • Count the number of rows inserted

    Hi,
    Is there a way to count the number of rows processed post DML in PL/SQL?
    For eg,
    BEGIN
    INSERT INTO TMP1
    SELECT * FROM EMP;
    a function to count the number of rows inserted into tmp1

    SQL> set serveroutput on;
    SQL> begin
    2 insert into tmp1 select * from emp;
    3 dbms_output.put_line(SQL%ROWCOUNT||' rows inserted');
    4 end;
    5 /
    15 rows inserted
    PL/SQL procedure successfully completed.

  • Counting the number of characters entered into a page item

    Is there a way to count the number of characters that are entered into a page item. I've got a field that can contain up to 20 characters. If 20 are entered I can do a = on my search, if less than that, then I have to do a wildcard search. I currently do a substr on the field to see if position 21 is null and position 20 is not null, then I have a 20 character field. Is there a more efficient way to do this and also is there a way to actually show the character count as the page item is being populated

    Hello user8014695 (name please),
    Try coding the select for your search as
    select ...
    from some_table
    where some_field like case when length(trim(:YOUR_ITEM)) = 20 then :YOUR_ITEM else :YOUR_ITEM || '%' end
    Note - I included the trim() assuming blank characters before or after shouldn't count.
    To show the character count as the item is being keyed-in, Google "javascript character count" for lots of ways to do this. To work these solutions into ApEx, check the ApEx help/documentation for incorporating JavaScript into your application - specifically the references on accessing page items using JavaScript.
    Hope this helps,
    John

  • How to retrieve the number of "free" rows in a table?

    Hi,
    if in a client only environment (no sync to mobile server) rows are inserted and deleted into a table,
    is there a way to retrieve the number of "free" rows in a table? Number of "Free" rows stands for
    number of rows that can be inserted again, before the table extents in size.
    Is there a way in OLite 10.3.0.2.0 to retrieve the size of tables and indexes? ALL_TABLES is not
    a place that really works.
    Best regards and many thanks,
    Gerd

    Hi Gary,
    many thanks, the partner uses a Lite client db without sync. The db runs inside an laboratory device and collects measures. There must be a way to estimate the the number of "measures" rows, that stil can be stored in the db.
    Than we need to make the deleted space available for new rows. The partner tested defrag.exe and found that it
    needs very long time to run, especially if the db is bigger than 2GB. ... and that this run sometimes fails.
    Is there any recommendation the partner can follow on?
    Thanks,
    Gerd

  • Count Number of Records in Oracle Database Table

    Please help me to see if I "set" and "return" the number of records in my database table correctly (I am using the Oracle 9i):
       public int getNumberOfRecipientBeans() throws AssertionException, DatabaseException
          Connection conn = null;
          PreparedStatement stmt = null;
          String query = "SELECT count(*) FROM ContactEntry WHERE ContactTypeID = 6";
          ResultSet rs = null;
          try
             conn = DBConnection.getDBConnection();
             stmt = conn.prepareStatement( query );
             rs = stmt.executeQuery();
             // do I have to set anything here?
             if ( !rs.next() )
                throw new AssertionException("Assertion in servuce.getNumberOfRecipients");
              // Am I returning the counts here?
              return rs.getInt( 1 );
          catch( SQLException sqle )
             sqle.printStackTrace();
             throw new DatabaseException( "Error executing SQL in service.getNumberOfRecipients." );
          finally
             if ( conn != null )
                try
                   stmt.close();
                   stmt = null;
                   conn.close();
                catch( Exception Ex )
                   System.out.println( "Problem occurs while closing " + Ex );
                conn = null;

    public class MyE extends Exception {
        public MyE() {
            super(); // this line is not necessary. An empty method would suffice
        public MyE(String msg) {
            super(msg);
        // Check the API for Exception or Throwable--I may have the args backward
        public MyE(String msg, Throwable cause) {
            super(msg, cause);
        public MyE(Throwable cause) {
            super(cause);
    // Replace the log_warn() calls with appropriate logging calls for your context
    public class Closer {
        public static final void close(ResultSet closeMe) {
            if (closeMe != null) {
                try {
                    closeMe.close();
                catch (Throwable th) { log_.warn("Closing " + closeMe + ": ", th); }
        public static final void close(Statement closeMe) {
            if (closeMe != null) {
                try {
                    closeMe.close();
                catch (Throwable th) { log_.warn("Closing " + closeMe + ": ", th); }
        public static final void close(Connection closeMe) {
            if (closeMe != null) {
                try {
                    closeMe.close();
                catch (Throwable th) { log_.warn("Closing " + closeMe + ": ", th); }
        public static final void close(ResultSet rs, Statement stmt, Connection con) {
            close(rs);
            close(stmt);
            close(con);
    }

  • Count the number of records between two key values (BTREE)

    How can I count the number of keys between two values?
    I'm using python driver, and BTREE access method.
    ====>
    ideally what I want is to average a whole time-series data set (the intervals can change) to a given number of points. The keys are the time stamps and the values are the data that needs to be averaged. I need to count the number of records between two time stamps so that I can divide that number by the number of points i need, and average the data. What is the best way to do this?  Or should I just keep the intervals for the time stamp constant and use RECNO access method?
    Thank you
    (first post btw.. and why aren't there many people in stackoverflow who answer Berkeley DB questions?)

    BDB is an embedded db and it does not have any internal counters or statistics that you could grap to use for this.    You will need to do it manually.
    You can create a cursor, grap the records you want, each time you get the next record you bump a counter.
    If you are using RECNO, you can use a cursor to get the record number of the record (DB_GET_RECNO), and if all you data is in
    sequentail records with no missing records you can figure out the total count by take last rec # - initial rec # + 1 to get a total count.
    If you switch over to the SQL API, you can issue a SQL query to give you a count.  Select count(*) Where .......
    Since you have to grab the data anyway, then best may be to count records as you go along.
    thanks
    mike

  • How to count the number of rows in a resultser object?

    hi there
    how to count the number of rows in a resultser object which may contains millions of rows? besides using a while loop? thanks

    You don't, you execute a query whose result is the record count of those records that match the search and then you execute the actual query to create your record set. Typically you do
    select count(id) from YourTable where [filter]
    from the resulting ResultSet do
    int res.getInt(1);
    which gives you the count and then
    select id from YourTable where [filter]
    to produce the actual result set.
    in the second query the id part can be substituted with the actual fields you want.

Maybe you are looking for

  • Computer Crashed,how do I get music back into itunes w/o erasing Ipod?

    My computer crashed, and I had to get a new hard drive. I was able to save all of my music on cd, and it is all still currently on my Ipod. I have downloaded Itunes again, but how do I upload all the music on my ipod into Itunes without it automatica

  • Camera doesn't work suddenly half way on FaceTime

    While on Facetime, the camera suddenly stop functioning. No green light. The camera doesn't work on photobooth as well. Already installed the latest OS which is 10.9 Any suggestion? or it is a hardware problem need repaired?

  • Change language SelfPortal MBAM 2.5

    Hi All, Please, can somebody tell me if it is possible to change language from english to spanish on selfportal? Regards jo

  • Email Broadcasting by encrypting the content

    Hi Gurus, I have a requirement to publish(broadcast) reports via email. And this should happen with encryption. Can someone help me with the step by step proceedure to be followed to have this broadcast email encryption functionality. Thanks in advan

  • Enterprise Manager Plug-ins vs. Connectors

    Hi, I'm trying to get more information on Enterprise Manager Connectors - what they are and how they differ from plug-ins. The Oracle Enterprise Manager 10g Grid Control Extensions Exchange home page makes several references to 'Connectors' but I can