How to get the number of rows in a report region

Hi all,
Is there a way to get the number of rows returned in a report region, without issuing an additional "select count(*) from some_table"?
I mean something like the substitution string #ROW_NUM# but for the total rows.
Thanks,
Pedro.

http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/ui.htm#CHDDGGEG
For classic report regions, the region footer supports the following substitution strings:#ROWS_FETCHED# shows the number of rows fetched by the Oracle Application Express reporting engine (the page size). You can use these substitution strings to display customized messages to the user. For example:
Fetched #ROWS_FETCHED# rows in #TIMING# seconds.
*#TOTAL_ROWS# displays the total number of rows that satisfy a SQL query used for a report.*
#FIRST_ROW_FETCHED# and #LAST_ROW_FETCHED# display the range of rows displayed. For example:
Row(s) #FIRST_ROW_FETCHED# through #LAST_ROW_FETCHED# of #ROWS_FETCHED# displayed>
Ta,
Trent

Similar Messages

  • How to get the number of rows in a repeating frame ?

    Hi all,
    When I launch a report from forms then sometimes there are data in the report and sometimes there are no data. And the problem is that when there are no data then the frame containing the repeating frame is still displaying and a blank page displays on the report.
    So I want to get the number of rows from the repeating frame so that I can code a format trigger on the frame to display or not the enclosing frame depending on the existence of data from the repeating frame.
    Thank you very much indeed.

    Dear Friend,
    You can achieve this. Define a summary column (say cnt). Select summary type as "COUNT". select any one of columns that are getting displayed in your repeating frame as summary column and provide "reset at" group name (or set this to report if you are defining this field at report level) . This "cnt" variable will contain how many records that will be fetched for your repeating frame (i.e. Group of Repeating frame). You can use this "CNT" variable in your format trigger.
    In this case there is no need to write before report trigger or anything.
    Regards,
    Manish Trivedi

  • How to get the number of rows in a DB-Cursor

    When i open a database cursor i do not know how much rows are stored in the cursor. To solve this problem i have to send a 'select count(1) ...' to get the number of rows before i set up the cursor. I think that this is not very clever and could possibly cause performance problems. But i need the num of rows to show the percentage of processed rows. Is there any other way to get the num of rows? May be by checking the cursor directly?
    Please help!
    Thanx a lot

    In order to find out how may rows are going to be processed, oracle has to visit every row. So with a cursor, there is no property that will accurately reflect the number of rows until you get to the last one. That said, you could use
    select count(*) over() as row_count, <rest of your columns> FROM <your table>
    which will give you the total row count agaist each row in the result set. There are performance penalties involved but they will be less than issuing the query twice, once to get the count and once to get the rows.
    Have a look on asktom for some very usefull info about all this.
    HTH

  • How to get the number of rows in a ResultSet

    Hello,
    I'm an intern and I'm trying to get the number of rows from result set in oracle using rs.last() and rs.beforeFirst() methods
    but I got an error. Could Below is my sample code:
    import java.sql.*;
    public class SarueckConnect {
    public static void main(String[] args) {
    Connection con = null;
    Statement stmt = null;
    ResultSet re = null;
    String[] ParamArray;
    ParamArray = new String[24];
    //Properties logon;
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver"); //Loading the Oracle Driver.
    con = DriverManager.getConnection
    ("jdbc:oracle:thin:@258.8.159.215:1521:test_DB","data","data"); //making the connection DB.
    stmt = con.createStatement ();// Sending a query string to the database
    //stmt.executeUpdate("UPDATE test_table set steuk = 6 WHERE steuk = 5");
    ResultSet rs = stmt.executeQuery("SELECT mandt,kokrs,werks,arbpl,aufnr,vornr,ile01,"+
    "lsa01,ism01,ile02,lsa02,ism02,ile03,lsa03,ism03,ile04,lsa04,ism04,steuk,matnr,budat,"+
    "kostl,pernr,rueckid FROM test_table where steuk =6");
    //Print the result out.
    rs.last(); //This is the line which gives an error.
    int rows = rs.getRow();
    rs.beforeFirst();// I presume this is wrong to.
    ParamArray = new String[24*rows];
    int counter=0;
    while (rs.next()) {
    for (int i = 1; i <= 24; i++){
    ParamArray[i-1+(counter*24)] = rs.getString(i);
    System.out.print(rs.getString(i) + '\t');
    System.out.println();
    counter++;
    } catch(Exception e) {
    e.printStackTrace();
    } finally {
    try
    if(stmt != null) stmt.close();
    if(con != null) con.close();
    } catch (Exception exception) {
    exception.printStackTrace();
    TryBapi sap = new TryBapi(ParamArray);
    }When I run the code I do have the following ERROR Message:
    java.sql.SQLException: Invalid operation for forward only resultset : last
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
    at oracle.jdbc.driver.BaseResultSet.last(BaseResultSet.java:91)
    at SarueckConnect.main(SarueckConnect.java:28)Please could any body Help me out here to figure out how to correct this?
    Any Help would be highly apprecited.

    make your result set scrollable...Not such a good idea. With Oracle, the JDBC driver will read and cache all the ResultSet in memory (with other DBMSs/drivers the behavior will probably be different, but you will still have some unnecessary overhead).
    You can do the caching yourself if you think it's worth it. If the piece of code you posted is why you need this for, then use a List or Vector and you won't need to know the size upfront.
    Alin,
    The jTDS Project.

  • How to get the number of rows written to the header of the spool file.

    Hi
    I need to create a header line for the spool file .
    the header line should include fixed length values .
    The header should include the number of records found in the table with a maximum begin date (begin_date is the column of the table)
    To get the header in the spool file , i wrote a select query has :-
    --SPOOL 'C:\Documents and Settings\abc\Desktop\output.TXT'
    select 'W'||to_char(sysdate,'MM/DD/YYYYMi:HH:SS')||lpad(max(rownum),9,'000000000') ||'R'||max(to_char(school_from_date,'MM/DD/YYYY')) ||
    rpad(' ',76,' ')
    from dad.school
    group by sysdate;
    SPOOL OFF
    which gets me all the rows in the table , but i only want the rows with the latest school_begin_date .
    how can i achieve that ...
    I know that a subquery should be written in the from clause to get the number of rows found with a maximum school_begin_date.
    select 'W'||to_char(sysdate,'MM/DD/YYYYMi:HH:SS')||lpad(max(rownum),9,'000000000') ||'R'||max(to_char(school_from_date,'MM/DD/YYYY')) ||
    rpad(' ',76,' ')
    from dad.school where
    select rownum from dad.school
    where school_begin_date = max(school_begin_date) ;
    the error i get is
    ORA-00934: group function is not allowed here
    I NEED HELP ..IN GETTING THE ROWNUM JUST FOR THE LATEST BEGIN_DATE ?
    PLS HELP ME IN WRITING THE QUERY .
    THANKS IN ADVANCE .

    Try this:
    select 'W'||to_char(sysdate,'MM/DD/YYYYMi:HH:SS')||lpad(max(rownum),9,'000000000')||'R'||max(to_char(school_from_date,'MM/DD/YYYY')) || rpad(' ',76,' ')
      from dad.school
    where school_begin_date = (select max(school_begin_date)
                                  from dad.school);

  • How to get the number of rows returned by a report?

    Hi,
    I'm developing my first application in APEX and so far everything seems fine, except I can't figure out this very simple thing: I have a report based on a PL/SQL block returning an SQL string. I'd like to have a message (something like "X rows returned") just before the report. The closest thing I could find was "X to Y out of Z" in the pagination styles, but that's not what I want. Also I don't think running the same query to get COUNT() is wise.
    Any help would be appreciated.
    Thanks,
    Konstantin

    My guess is that it only shows the number of rows it has retrieved. I believe the defailt is for it to only retrieve 50 rows and as you page through your report it retrieves more. So this would just tell you how many rows was retireved, but probably not how many rows the report would contain if you pages to the end. Oracle doesn't really have a notion of total number of rows until the whole result set has been materialized.

  • How to limit the number of rows in a report

    I have several reports with a number of parameters - date ranges etc.
    Depending on the parameter values selected by the user the reports can return thousands of rows.
    I would like to limit the number of rows returned to, say, 500. If more than 500 rows are returned by the query then display an error message requesting that the user enter more specific parameters.
    Ideally for performance reasons it would be good to catch the error before the datafile is generated, but I don't know if this is possible. Alternatively a check in the template might do the job - using COUNT on the group?.

    Hi Hugh,
    In your query, you got to add rowum < 500 or some sort of DB specific limit to the row being returned,
    this will help to stop the report to get more than 500 records and the report template wont have any restriction.
    or
    you can do that in template too, but i would not recommend.
    In these both cases or in any case, you cannot give any meaningful error if it exceeds N rows,there is no option like this till now.

  • How to get the number of rows in a HTML table in some other page

    Hi,
    I am incrementing HTML table rows on button click and saving number of rows in a javascript variable. But on submitting that page I need that number of row value in the following page
    example:
    HTML table is in the page first.jsp
    and the javascript variable having the current row number is row_number
    on submitting it goes to second.jsp page. There i need that row_number value.
    Can anyone help me to solve this?
    regards,
    carry

    function buttonClick()
    var table = profileTable;
    var lnRow = table.rows.length;
    var insertedRow = table.insertRow(parseFloat(lnRow));
    var cell1 = insertedRow.insertCell();
    cell1.innerHTML ="<tr><td><Input type=\"hidden\" >>>name=\"rowNum\" value="+cnt"+></td></tr>";
    document.profileform.submit;
    on submit it goes to the second page, but the value i got using >>>System.out.println("row number from text >>>box"+request.getParameter("rowNum")); is null. What is wrong with >>>my coding. Can anyone solve this.HI carry
    Check the value of bold data
    function buttonClick()
    var table = profileTable;
    var lnRow = table.rows.length;
    var insertedRow = table.insertRow(parseFloat(lnRow));var cnt=inRow
    var cell1 = insertedRow.insertCell();
    cell1.innerHTML ="<tr><td><Input type=\"hidden\" >>>name=\"rowNum\" value="+cnt+"></td></tr>";
    document.profileform.submit;
    }try with it

  • 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

  • Get the number of rows affected by update statement

    Hi
    I'm working on an application that uses OCI as interface against an Oracle database.
    I'm trying to find out how i can get the number of rows affected by a query executed with OCIStmtExecute. it is not a select query.
    Best regards,
    Benny Tordrup

    If I run a bulk UPDATE query using OCIBindArrayOfStruct, is there a way I can tell which+ rows successfully updated?
    I have a file of records of which 75% of PKs are already in the table and will be updated, the other 25% aren't and should be inserted later. I want to attempt an UPDATE statement using OCIBindArrayOfStruct to execute in bulk and then check which entries in my bulk array successfully updated. If an array entry isn't successfully updated then I will assume it should be inserted and will store it for a Direct Path load later.
    Many thanks for any advice you can give as I've been trawling through the docs trying to find a solution for ages now.

  • Indesign CS3: How to get the number of the current layer?

    Hallo!
    How to get the number of the current layer in a page?
    Thanks,
    Alois Blaimer

    InterfacePtr<ILayerList> layerList(documentUIDRef, UseDefaultIID());          <br /><br />int32 layerCount = layerList->GetCount();<br /><br />To findout layer name use<br /><br />IDocumentLayer* documentLayer = layerList->QueryLayer(layerIndex);<br />                         <br />PMString layer=documentLayer->GetName();

  • How to increase the number of rows in Status Oveview iView in MSS?

    Hi
    We have implemented MSS and have a question regarding Status overview iview.
    The standard status overview iview of the team workset has 5 rows and we have to scroll using the arrow buttons to select/view a request.
    Now can anyone explain me how to increase the number of rows in this iview? Is this somthing that has to be accoplished through web dynpro customization?
    I checked the options in iView property and do not see any option to increase the number of rows.
    please help
    Thanks
    -Michael

    Hi Micheal,
    Well, I am not really sure, if you could accomplish this using customizing, but I am sure that you can accomplish this using the JDI. Well, you can extract the application's source code using JDI and then change the required display rows property and republish it.
    Am not really sure if this is suggestable method for this requirement,but it can be achieved using this JDI stuff.
    Regards
    <b>Raja Sekhar</b><i></i>

  • How to increase the number of rows to be displayed in BEx Web Analyzer

    hi,
    I am viewing reports using BEx Web analyzer option. It is displaying only 24 rows  of data at a time. How to increase the number of rows? do i need to any kind of settings?
    pls reply.

    Hi,
    I think the standard template in 2004s is named 0ANALYSIS_PATTERN. You can find it in Web Application Designer, open, and search for the technical name. If you want to change the number of rows or columns, you can find this setting near the bottom of the XHTML view of the template:
    <bi:BLOCK_COLUMNS_SIZE value="4" />
    <bi:BLOCK_ROWS_SIZE value="17" />
    Then just save, and ignore the error messages.
    Message was edited by:
            vind Reinsberg

  • How to limit the number of rows in a smart form , sap script.

    Can anyone tell me how to limit the number of rows in the output of a sap script/smart form. I have tried "protect/endprotect" in sap script but have no idea of how to do in smart form. In sap script the only way it has happened is by reducing the size of the main window.

    Hi,
    In Smartform also, why dont you try reducing the size of the window if you want to limit the rows in it. Also if you are printing Line Items in a LOOP, you can write
    LOOP AT T_ITAB FROM 1 TO N in the LOOP Node if you know how many records exactly you want to display in 1 Page processing.
    regards,
    Mahesh

  • 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