Count total rows in database?

Hello all,
Is there a way to query the database for the total number of rows.... without using ANALYZE STATISTICS? (That would cause the db to sometimes use COST instead of RULE based optimization, slowing it down significantly.)
I know I could could brute force a total row count with something like:
spool get_total_rows.sql
SELECT 'SELECT COUNT(*) FROM '||owner||'.'||table_name||';'
FROM ALL_TABLES;
spool off
...then run get_total_rows and manually add all the counts.
But it just seems like there must be a cleaner way to do it.
Thanks much,
Natasha

ok. here you have that information:
ALL_TABLES
ALL_TABLES describes all relational tables accessible to the current user. To gather statistics for this view, use the SQL ANALYZE statement.
Related Views
DBA_TABLES describes all relational tables in the database.
USER_TABLES describes all relational tables owned by the current user. This view does not display the OWNER column.
Note:
Columns marked with an asterisk are populated only if you collect statistics on the table with the ANALYZE statement or the DBMS_STATS package.
Column Datatype NULL Description
OWNER
VARCHAR2(30)
Owner of the table
TABLE_NAME
VARCHAR2(30)
Name of the table
TABLESPACE_NAME
VARCHAR2(30)
Name of the tablespace containing the table; NULL for partitioned, temporary and index-organized tables
CLUSTER_NAME
VARCHAR2(30)
Name of the cluster, if any, to which the table belongs
IOT_NAME
VARCHAR2(30)
Name of the index-organized table, if any, to which the overflow entry belongs. If IOT_TYPE column is not null, this column contains the base table name.
PCT_FREE
NUMBER
Minimum percentage of free space in a block; NULL for partitioned tables
PCT_USED
NUMBER
Minimum percentage of used space in a block; NULL for partitioned tables
INI_TRANS
NUMBER
Initial number of transactions; NULL for partitioned tables
MAX_TRANS
NUMBER
Maximum number of transactions; NULL for partitioned tables
INITIAL_EXTENT
NUMBER
Size of the initial extent in bytes; NULL for partitioned tables
NEXT_EXTENT
NUMBER
Size of the secondary extension bytes; NULL for partitioned tables
MIN_EXTENTS
NUMBER
Minimum number of extents allowed in the segment; NULL for partitioned tables
MAX_EXTENTS
NUMBER
Maximum number of extents allowed in the segment; NULL for partitioned tables
PCT_INCREASE
NUMBER
Percentage increase in extent size; NULL for partitioned tables
FREELISTS
NUMBER
Number of process freelists allocated to this segment; NULL for partitioned tables
FREELIST_GROUPS
NUMBER
Number of freelist groups allocated to this segment; NULL for partitioned tables
LOGGING
VARCHAR2(3)
Logging attribute; NULL for partitioned tables
BACKED_UP
VARCHAR2(1)
Has table been backed up since last change
NUM_ROWS*
NUMBER
Number of rows in the table
BLOCKS*
NUMBER
Number of used data blocks in the table
EMPTY_BLOCKS*
NUMBER
Number of empty (never used) data blocks in the table
AVG_SPACE*
NUMBER
Average amount of free space, in bytes, in a data block allocated to the table
CHAIN_CNT*
NUMBER
Number of rows in the table that are chained from one data block to another, or which have migrated to a new block, requiring a link to preserve the old ROWID
AVG_ROW_LEN*
NUMBER
Average length of a row in the table in bytes
AVG_SPACE_FREELIST
_BLOCKS
NUMBER
The average freespace of all blocks on a freelist
NUM_FREELIST_BLOCKS
NUMBER
The number of blocks on the freelist
DEGREE
VARCHAR2(10)
The number of threads per instance for scanning the table
INSTANCES
VARCHAR2(10)
The number of instances across which the table is to be scanned
CACHE
VARCHAR2(5)
Whether the cluster is to be cached in the buffer cache (CACHE | NOCACHE)
TABLE_LOCK
VARCHAR2(8)
Whether table locking is enabled or disabled
SAMPLE_SIZE
NUMBER
Sample size used in analyzing this table
LAST_ANALYZED
DATE
Date on which this table was most recently analyzed
PARTITIONED
VARCHAR2(3)
Indicates whether this table is partitioned. Set to YES if it is partitioned.
IOT_TYPE
VARCHAR2(12)
If this is an index-organized table, then IOT_TYPE is IOT, IOT_OVERFLOW, or IOT_MAPPING. If this is not an index-organized table, then IOT_TYPE is NULL.
TEMPORARY
VARCHAR2(1)
Can the current session only see data that it place in this object itself?
SECONDARY
VARCHAR2(1)
Whether the trigger is a secondary object created by the ODCIIndexCreate method of the Oracle9i Data Cartridge (Y |N)
NESTED
VARCHAR2(3)
Is the table a nested table?
BUFFER_POOL
VARCHAR2(7)
The default buffer pool for the object. NULL for partitioned tables
ROW_MOVEMENT
VARCHAR2(8)
Whether partitioned row movement is enabled or disabled
GLOBAL_STATS
VARCHAR2(3)
For partitioned tables, indicates whether statistics were collected for the table as a whole (YES) or were estimated from statistics on underlying partitions and subpartitions (NO)
USER_STATS
VARCHAR2(3)
Were the statistics entered directly by the user?
DURATION
VARCHAR2(15)
Indicates the duration of a temporary table:
SYS$SESSION: the rows are preserved for the duration of the session
SYS$TRANSACTION: the rows are deleted after COMMIT
Null for a permanent table
SKIP_CORRUPT
VARCHAR2(8)
Whether Oracle ignores blocks marked corrupt during table and index scans (ENABLED) or raises an error (DISABLED). To enable this feature, run the DBMS_REPAIR.SKIP_CORRUPT_BLOCKS procedure.
MONITORING
VARCHAR2(3)
Whether the table has the MONITORING attribute set
Try with ALL_TABLES and post if the results were zero too
Joel P�rez

Similar Messages

  • Count total rows?

    Hello,
    In some function of my program, I need to count total number of rows but, I don't need to fetch results. Only the number of rows.
    Is there any way to count the total number of result rows without fetch?
    In OCI ver.7, it was very simple.
    Just Call ofen() (OCIStmtFetch() in ver.8) without defining, but it's impossible that fetch without defining in Ver.8
    Is there any idea to solve this situation?
    I can defining and fetching just like normal process, but customer can send any SQL statement so, it can include LOBs.. and so on.
    It's very waste source codes and memory for just counting rows.
    Thank you

    One possibility is to execute a different statement
    (i.e. select count(*) from foo;) to get the number of
    rows directly. This would probably be the most efficient
    way to get the row count (since no row data is shipped
    with this statement).
    Unfortunately, I was unable to fetch rows w/o defining
    in OCI either (I got an ORA-24374), so I am not sure how
    you can get around this.
    Incidentallly, when fetching LOBs, I don't think that
    the entire lob is fetched, only the LOB locator. In this
    case, there is very little over head associated with the
    data transfer.
    Also, I believe that ofen() was doing roundtrips in the
    past, and my impression was that the latency of the
    roundtrip to the server (and not the associated latency
    of transferring the data) was the bottleneck here. Hence,
    there may not be as much of a performance penalty as
    expected for doing the extra client define with OCI
    v8. So you still might be able to use your old ofen logic
    (after replacing with OCIStmtExecute/OCIDefine) and not
    see a very high performance hit.
    Hope that helps out somewh

  • Count ALL rows in databases

    Hi experts!
    I need the total number of ROWS in EACH database i have (All schema)
    I've tried this for each DB
    select sum(num_rows)
    from sys.dba_tables
    where owner like '%%'
    i obtain the number of all rows for all schema in database.
    I have many database, i use agent g10.0 and enterprice manager to query them.
    I
    've seen that in Enterprise Manager, when you select a Database Istance, then go on "administration" tab, and u click on TABLES link, you can see number of rows and last time the table was analyzed. How are they have been calculated? With table dba_tables? How can i query to obtain these values?
    I know it's a stupid task but my boss wants this info :(

    > I know it's a stupid task but my boss wants this info :(
    Tell him two gazillion. Also tell him that the gazillion scale has been specifically created for managers like him with heads firmly stuck up the back side.
    Anyway, here's some sample code. Note that you cannot use DBA_TABLES view. Object tables are not listed in there and they can contain rows (obviously). There is also the case of dealing with case and "weirdly" names tables - thus double quotes are needed.
    I only did the first 10 tables.. It is stupid to just one, never mind all of them in database...
    SQL> declare
    2 type TStrings is table of varchar2(1000);
    3
    4 cursor c is
    5 select '"'||owner||'"."'||object_name||'"' as TAB_NAME from dba_objects where object_type='TABLE' and rownum < 11 order by 1;
    6
    7 tabList TStrings;
    8 sqlSelect varchar2(1000);
    9 cnt integer;
    10 total integer;
    11
    12 procedure W( line varchar2 ) is
    13 begin
    14 DBMS_OUTPUT.put_line( line );
    15 end;
    16 begin
    17 total := 0;
    18 open c;
    19 loop
    20 fetch c bulk collect into tabList limit 100;
    21 for i in 1..tabList.Count
    22 loop
    23 sqlSelect := 'select count(*) from '||tabList(i);
    24 begin
    25 execute immediate sqlSelect into cnt;
    26 total := total + cnt;
    27 W( sqlSelect || ' ' || cnt || ' rows(s)' );
    28 exception when OTHERS then
    29 W( sqlSelect || ' ' || sqlerrm(sqlcode) );
    30 end;
    31 end loop;
    32 exit when c%NOTFOUND;
    33 end loop;
    34 close c;
    35 W( total|| ' gazillion rows in the database' );
    36 end;
    37 /
    select count(*) from "SYS"."CLU$" 10 rows(s)
    select count(*) from "SYS"."COL$" 43696 rows(s)
    select count(*) from "SYS"."CON$" 2898 rows(s)
    select count(*) from "SYS"."FILE$" 5 rows(s)
    select count(*) from "SYS"."ICOL$" 2184 rows(s)
    select count(*) from "SYS"."IND$" 1434 rows(s)
    select count(*) from "SYS"."PROXY_ROLE_DATA$" 0 rows(s)
    select count(*) from "SYS"."SEG$" 3032 rows(s)
    select count(*) from "SYS"."UET$" 0 rows(s)
    select count(*) from "SYS"."UNDO$" 11 rows(s)
    53270 gazillion rows in the database
    PL/SQL procedure successfully completed.
    SQL> PS. Cursor needs fine tuning as certain table objects cannot be directly accessed via a SELECT statement (e.g. nested tables, overflow IOT tables, etc).

  • Count total rows in vo.

    Dear All,
    I have a af:showDetailItem in which i have a af:table. I want to show the total number of records in the header of af:showDetailItem.
    example:
    Employees  (count=10)
    So any one have any idea of how to solve this problem.?
    Regards,
    Santosh.
    Component              Version
    ================================================
    ADF Business Components         11.1.1.59.23
    Java(TM) Platform         1.6.0_21
    Oracle IDE              11.1.1.4.37.59.23
    Versioning Support         11.1.1.4.37.59.23

    You can use estimatedRowCount on tree binding.
    Sample:
    <af:showDetailItem text="Employees (count = #{bindings.<Tree_Binding>.estimatedRowCount})" ...>
         <af:table value="#{bindings.<Tree_Binding>.collectionModel}" ...>
         </af:table>
    </af:showDetailItem>Sireesha

  • Find Total Number of Rows in Database

    I am trying to find total number of rows in Database? Thanks in advance

    I'd come back to a question of "why". What possible reason could you have to want to know the number of rows in every table in the database?
    This seems like it is a request from someone non-technical where they're not sure exactly what they need to ask to get the information they want. I'm forseeing something along the lines of
    User: How many rows are in the database
    DBA: Ummm.... <<goes off and spends a lot of resources to count>>> ... 1 billion.
    User: Wow, that's a lot... How big are those rows...
    DBA: Hmmm... <<goes off and spends more time trying to find an average row size>>... 100 bytes
    User: <<Plugs numbers into Excel>>... OK, our database is 93 GB, so we need to order 100 GB of disk for our new environment.
    DBA: <<Months later, after 100 GB of disk has been budgeted, purchased, and delivered>> User, you didn't order enough disk for our disaster recovery environment.
    User: You said our database was only 93 GB!!
    DBA: 93 GB of data. Plus 100 GB of indexes, TEMP, UNDO, space for archived logs, ...
    When "odd" requests come down, it's generally the case that the person asking the question doesn't know what question they really want to ask because they don't have the domain knowledge to know how to ask the question. Walking over and asking them what they're hoping to accomplish/ what they're using the data for generally leads to a case where
    - The user gets exactly the information they need, not the information they think they want
    - The DBA does a lot less work, since the right question is almost always easier to answer
    - The user thinks of the DBA as a really helpful sort of guy and remembers how helpful you were in the past when you have to push back on other things later
    - No one ends up playing the blame game when the user gets just what they asked for and not what they want.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Total row count - where from is that value?

    Hi,
    I need the value of total row count that is displayed at the button of portal report. I need this value to use in my java script.
    Is that value somewhere in database? Maybe any variable or hidden form element on the page?
    Where from does the portal know when to show only the previous button and when both next and previous? It must by calucated somehow.
    Thanks in advance.
    best regards
    Krzysztof Jungowski
    null

    Thanks. Just to make clear:
    Probelm:
    I need to display links to pages with part of results at the bottom of page - just like in discussion group: Pages: [1] [2] [3] ....
    Solution:
    I know that there is a hidden form on every report rendered by portal. In that form there are several elements like:
    pagenumer, minrow and maxrows. Updating these elements I can jump to every page with results.
    Total row count problem:
    The problem is that I don't know the number of pages. If I had a total row count value I would calculate the number of pages and create links only to existing pages.
    best regards
    Krzysztof Jungowski

  • Count all rows of a Database table

    I want to count all the rows of a table.
    I have made correctly the connection with the database and all the other things (make a statement, make the query and the resultSet), I use the MySQL server v4.0.17
    Here is the code I use:
    int count=0;
    String temp=null;
    String query = "SELECT COUNT(*) FROM customers";//customers is my Database Table
    try {
    rs = stmt.executeQuery(query);
    }//end try
    catch(Exception exc) {
    createFeatures.PlayErrorSound(registerRenter);
    Optionpane.showMessageDialog(registerRenter,
    "MESSAGE", "ERROR", JOptionPane.ERROR_MESSAGE);
    }//end catch
    try {
    while(rs.next()) {
    count++; //I use this variable in order to count the rows because the resultSet doesn't tell me the answer
    countLine=rs.getInt(1);
    }//end while
    }//end try
    catch(Exception exc) {
    createFeatures.PlayErrorSound(registerRenter);
    Optionpane.showMessageDialog(registerRenter,
    "MESSAGE", "ERROR", JOptionPane.ERROR_MESSAGE);
    }//end catch
    count=count++; //i increase it aggain because if the rows are initial 0 i want to make it 1
    temp = String.valueOf(count);//i use this command in order to display the result into a jtextfield
    Any help is appreciated!!!!!

    This program will work just fine against mysql:
    mport java.util.*;
    import java.io.*;
    import java.sql.*;
    public class Test {
    public static void main(String []args) {
    String url= "jdbc:mysql://localhost/adatabase";
    String query = "select count(*) from foo2";
    String createQuery="create table foo2(f1 int)";
    String dropQuery="drop table foo2";
    String insertQuery="insert into foo2 values(1)";
    Properties props = new Properties();
    props.put("user", "auser");
    props.put("password", "xxxxx");
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    System.out.println("Connecting to the msql server");
    Connection con = DriverManager.getConnection(url, props);
    Statement stmt = con.createStatement();
    try {
    stmt.executeUpdate(dropQuery);
    } catch(SQLException e) {}
    stmt.executeUpdate(createQuery);
    stmt.executeUpdate(insertQuery);
    stmt.executeUpdate(insertQuery);
    PreparedStatement pstmt = con.prepareStatement(query);
    System.out.println("***Executing a select");
    ResultSet rs = pstmt.executeQuery();
    while (rs.next()) {
    System.out.println("RowCount="+ rs.getString(1));
    rs.close();
    pstmt.close();
    stmt.close();
    con.close();
    } catch(Exception e) {
    System.out.println(e.getMessage());
    }

  • Count total number of rows present in the schema

    Count total number of rows present in the schema including table, sequence, view
    Desirable Output
    table          Sequence     Views
    1000          20          1000

    You mean You need to count the No of Tables, View and Sequence Present in the Schema ??
    Hi Some thing like this,
    SELECT a.view_cnt AS "View Count", b.tab_cnt AS "Table Count",
           c.seq_cnt AS "Sequence Count"
      FROM (SELECT COUNT (*) view_cnt
              FROM USER_VIEWS) a,
           (SELECT COUNT (*) tab_cnt
              FROM USER_TABLES) b,
           (SELECT COUNT (*) seq_cnt
              FROM USER_SEQUENCES) cWhich give you,
    View Count      Table Count      Sequence Count
           153              878                   32Thanks,
    Shankar
    Edited by: Shankar Viji on Aug 28, 2012 3:03 AM

  • Present a total count of rows

    I'd like to present a total count of rows in the bottom of a report.
    how would you recommand me to do it???
    the point is that it must be presented in each report so i thought to add some HTML code to "After Rows" section in the report template. but i need a variable (or some substitution string) which will contain the total count. but how do i define a substitution string?

    as i mentioned i need to present a total count in the buttom of each report in my application. therefore I think it's reasonable to add a code in the report template, which present some variable which count all rows in a report.
    #TOTAL_ROWS# doesn't work if i place it on the template html code, though it works fine if i place it in the report region definition:
    <br><b>Total Number of Results:</b> #TOTAL_ROWS#.</br>
    why can't i use #TOTAL_ROWS# as a template variable? and how can i do that?

  • The best way to do paging and get total rows count given a sql statement

    Hi,
    Just got a quick question.... what is the best way to do paging as well as the total rows count given by a sql statement.
    e.g. "select * from emp"
    1. I need to know the total row count for this statement.
    2. I also need to do a 10 rows per page....
    Is there a way to do it in a SINGLE statement for best performance?
    Thanks experts.

    Sounds more like a "formatting" problem...
    If Sql*plus is your reporting tool, check out the guide:
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a90842/toc.htm

  • 3.0.9.8.5 - Total Row Count in reports

    "Total Row Count" seems to be broken after applying patch 3.0.9.8.5.
    After applying the patch, we viewed an existing report which returned (let's say) 25 rows (and I've got max rows per page set to 5):
    The first page correctly says: "Total Row Count in Report- 25" and "Row(s) 1 - 5 "
    But then clicking the 'next' button, the following page incorrectly says: "Total Row Count in Report- 10" and "Row(s) 6 - 10 "
    So, the total row count is getting screwed up. Clicking "previous" in the example above, the total row count goes down to '5'.
    Another 3.0.9.8.5 patch problem appears to be 5 extra <br>'s within the report customize page top level of buttons and the criteria form. Looks ugly.

    Thanks for the reply.
    Is there nothing I can do to fix this problem before the next 3.0.9 patch comes out? We've have perhaps another few months to go before we make the move to portal release 2.
    This one issue with patch 3.0.9.8.5 is mostly definitely a show-stopper for us...we cannot live with customers seeing errors as basic as "total rows" returned in queries....we will have to roll back to our previous patch level 3.0.9.8.3. By doing this, we will continue to get bad customer feedback because of the awful performance introduced by that patch (Internet Explorer HTTP 1.0 vs 1.1 / keepalives / SSL issue). That's not to mention that we won't see the benefits of the content-area export/import bug fixes in this latest pathset.
    So, if there is ANYTHING we can do to fix this one problem, we (and our customers) would greatly appreciate hearing about it.
    thanks,
    -john

  • Count total no of ip addresses from a database

    how can we count total number of ip addresses from a database using jsp
    Edited by: 863765 on Jun 6, 2011 7:26 PM

    863765 wrote:
    yes IP addresses are in database, so I need to count the total number of ip addressesIs the issue connecting to the database containing the IP addresses? Or writing the SQL to query the database to get the count of IP addresses? Also, do you need a count of unique IP's or just all IP's in the database even if there are duplicates?

  • Answers: total row count

    Ist it possible to print the total row count on the first or each page?
    Regards,
    Stefan

    I am relatively new to Answers. How do use row level count function?

  • Add a row after Total row in ALV report

    Hi Experts,
    I have a report is displayed by  ALV format(not use function module to display it but use Class cl_gui_custom_container),I want to add a row after the total row. for example,
    Customer   amount1    amount2    amount3 
    10000         1,234        1,000         2,000
    10001         4,000        2,000         1,000
    10002         1,300        1,000         3,000
    11000         1,200        4,000         3,000
         Total:     7,734        8,000         9,000
    Ratio%        31.27       32.34          36.39
    the row of 'Total' is calculated by fieldcat-do_sum = 'X' But after the Total row we need a Ratio row to display the ratio. Yes we can calculate the total amout and ratio and then append it into the output itab, but we don't like this solution.We want to keep the total function in the ALV report.Any experts can poit me a direction. Thanks in advance.
    Joe

    Djoe,
    First you need to handle the user command,in order to capture the button action. For this you need to implment a class, i  am attaching sample codes here
    In top include write the following code
    CLASS lcl_event_handler DEFINITION .
      PUBLIC SECTION .
        METHODS:
         handle_toolbar  FOR EVENT toolbar                   " To add new functional buttons to the ALV toolbar
                         OF        cl_gui_alv_grid
                         IMPORTING e_object,
         handle_user_command FOR EVENT user_command          " To implement user commands
                            OF cl_gui_alv_grid
                            IMPORTING e_ucomm .
      PRIVATE SECTION.
    ENDCLASS.                                               " Lcl_event_handler DEFINITION
    Now   <b>Class implementation</b>
    CLASS lcl_event_handler IMPLEMENTATION .
      METHOD handle_toolbar.                                " Handle Toolbar
        PERFORM f9500_handle_toolbar USING e_object.
    ENDMETHOD .                                            " Handle_toolbar
      METHOD handle_user_command .                          " Handle User Command
        PERFORM f9600_handle_user_command USING e_ucomm .
      ENDMETHOD.
    ENDCLASS .                                              " lcl_event_handler IMPLEMENTATION
    FORM f9600_handle_user_command USING p_e_ucomm TYPE sy-ucomm.
      CONSTANTS:c_newl(4) TYPE c
                          VALUE 'NEWL',               " New line
                c_copy(4) TYPE c
                          VALUE 'COPY',               " Copy
                c_corr(4) TYPE c
                          VALUE 'CORR'.               " Correction
      CASE p_e_ucomm .
        WHEN c_newl.
    Create a new line
          PERFORM f9610_insert_new_line.
    ENDFORM.                                          " f9600_handle_user_command
    FORM f9610_insert_new_line .
    *Data Declarations
      DATA: lt_rows     TYPE lvc_t_row,                 " Itab for row property
            ls_rows     TYPE lvc_s_row,                 " Work area for row
            lv_cntid    TYPE i.                         " Counter
      DATA: gv_index TYPE sy-index.
      CLEAR gs_last.
      CALL METHOD gr_alvgrid->get_selected_rows
        IMPORTING
          et_index_rows = lt_rows.
      READ TABLE lt_rows INTO ls_rows INDEX 1.
      IF sy-subrc EQ 0.
        gv_index = ls_rows-index + 1.
      ELSE.
        gv_index = 1.
      ENDIF.
      DESCRIBE TABLE gt_last LINES lv_cntid.
      lv_cntid = lv_cntid + 1.
      gs_last-cntid = lv_cntid.
      INSERT gs_last INTO gt_last INDEX gv_index.
      LOOP AT gt_last INTO gs_last FROM gv_index TO gv_index.
    Make the new line editable
        PERFORM f9611_style.
      ENDLOOP.
      CALL METHOD gr_alvgrid->refresh_table_display
        EXCEPTIONS
          finished = 1
          OTHERS   = 2.
    ENDFORM.                    " f9610_insert_new_line
    You can ask questions doubts if any!
    regards
    Antony Thomas

  • HOW TO DELETE THE ROW FROM DATABASE

    hI,
    Iam pasting my code below.My problem isi retrieve rows from database and display them in jsp page in rows.For each row there is delete hyperlink.Now when i click that link i should only delete the row corresponding to that delete link temporarily but it should not delete the row from database now.It should only delete the row from database when i click the save button.How can i do this can any one give some code.
    thanks
    naveen
    [email protected]
    <%@ page language="java" import="Utils.*,java.sql.*,SQLCon.ConnectionPool,java.util.Vector,java.util.StringTokenizer" %>
    <html>
    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>Item Details</title>
    <script>
    function submitPage()
    document.details.action = "itemdetails.jsp" ;
    document.details.submit();
    </script>
    </head>
    <body>
    <form name="details" action="itemdetails.jsp" method="post">
    <%
    ConnectionPool pool;
    Connection con = null;
    Statement st;
    ResultSet rs =null;
    %>
    <table border="0" cellpadding="0" cellspacing="0" width="328">
    <tr>
    <td width="323" colspan="4"><b>Reference No :</b> <input type="text" name="txt_refno" size="14">
    <input type="submit" value="search" name="search" ></td>
    </tr>
    <tr>
    <td width="81" bgcolor="#000099"><font color="#FFFFFF"><b>Item Code</b></font></td>
    <td width="81" bgcolor="#000099"><font color="#FFFFFF"><b>Item No</b></font></td>
    <td width="81" bgcolor="#000099"><font color="#FFFFFF"><b>Amount </b></font></td>
    <td width="80" bgcolor="#000099"> </td>
    </tr>
    <%
    pool= new ConnectionPool();
    Utils utils = new Utils();
    double total =0.00;
    String search =utils.returnString(request.getParameter("search"));
    if(search.equals("search"))
    try
    String ref_no =utils.returnString(request.getParameter("txt_refno"));
    String strSQL="select * from ref_table where refno='" + ref_no + "' ";
    con = pool.getConnection();
    st=con.createStatement();
    rs = st.executeQuery(strSQL);
    while(rs.next())
    String itemcode=rs.getString(2);
    int item_no=rs.getInt(3);
    double amount= rs.getDouble(4);
    total= total + amount;
    %>
    <tr>
    <td width="81"><input type=hidden name=hitem value=<%=itemcode%>><%=itemcode%></td>
    <td width="81"><input type=hidden name=hitemno value=<%=item_no%>><%=item_no%></td>
    <td width="81"><input type=hidden name=hamount value=<%=amount%>><%=amount%></td>
    <td width="80"><a href="delete</td>
    </tr>
    <%
    }catch(Exception e){}
    finally {
    if (con != null) pool.returnConnection(con);
    %>
    <tr>
    <td width="323" colspan="4">
    <p align="right"><b>Total:</b><input type="text" name="txt_total" size="10" value="<%=total%>"></td>
    </tr>
    <tr>
    <td width="323" colspan="4">                   
    <input type="button" value="save" name="save"></td>
    </tr>
    </table>
    </form>
    </body>
    </html>

    You mean when you click on the hyperlink you want that row to disappear from the page, but not delete the row from the database until a commit/submit button is pressed?
    Personally, I think I'd prefer that you have a delete checkbox next to every row and NOT remove them from the display if I was a user. You give your users a chance to change their mind about their choice, and when they're done they can see exactly which rows will be deleted before they commit.
    You know your problem, of course, so you might have a good reason for designing it this way. But I'd prefer not removing them from the display. JMO - MOD

Maybe you are looking for