Display max rows returned by a sql report

Hi all
how can i display the sql%rowcount from a report based on a sql-query. Is there a substitution string available to show me the "rows(s) 1-n of ??" in the pageination link?
Thanks
Martin

Greg :
Of course, I can not use the same query twice, I have many reports in many pages, if I do it with a select count in another query...it will mean that if I have 3 reports in a page, I will run 6 queries instead of 3.
Another thing: If I use : max rownum in the report query, I will get the number of records but in a report column, and I want this value to be displayed of out the report....in this case, how can I get this column value in a page item ? have you an idea ?
Thanks a lot.

Similar Messages

  • [Forum FAQ] How do I send multiple rows returned by Execute SQL Task as Email content in SQL Server Integration Services?

    Question:
    There is a scenario that users want to send multiple rows returned by Execute SQL Task as Email content to send to someone. With Execute SQL Task, the Full result set is used when the query returns multiple rows, it must map to a variable of the Object data
    type, then the return result is a rowset object, so we cannot directly send the result variable as Email content. Is there a way that we can extract the table row values that are stored in the Object variable as Email content to send to someone?
    Answer:
    To achieve this requirement, we can use a Foreach Loop container to extract the table row values that are stored in the Object variable into package variables, then use a Script Task to write the data stored in packages variables to a variable, and then set
    the variable as MessageSource in the Send Mail Task. 
    Add four variables in the package as below:
    Double-click the Execute SQL Task to open the Execute SQL Task Editor, then change the ResultSet property to “Full result set”. Assuming that the SQL Statement like below:
    SELECT   Category, CntRecords
    FROM         [table_name]
    In the Result Set pane, add a result like below (please note that we must use 0 as the result set name when the result set type is Full result set):
    Drag a Foreach Loop Container connects to the Execute SQL Task. 
    Double-click the Foreach Loop Container to open the Foreach Loop Editor, in the Collection tab, change the Enumerator to Foreach ADO Enumerator, then select User:result as ADO object source variable.
    Click the Variable Mappings pane, add two Variables as below:
    Drag a Script Task within the Foreach Loop Container.
    The C# code that can be used only in SSIS 2008 and above in Script Task as below:
    public void Main()
       // TODO: Add your code here
                Variables varCollection = null;
                string message = string.Empty;
                Dts.VariableDispenser.LockForWrite("User::Message");
                Dts.VariableDispenser.LockForWrite("User::Category");
                Dts.VariableDispenser.LockForWrite("User::CntRecords");     
                Dts.VariableDispenser.GetVariables(ref varCollection);
                //Format the query result with tab delimiters
                message = string.Format("{0}\t{1}\n",
                                            varCollection["User::Category"].Value,
                                            varCollection["User::CntRecords"].Value
               varCollection["User::Message"].Value = varCollection["User::Message"].Value + message;   
               Dts.TaskResult = (int)ScriptResults.Success;
    The VB code that can be used only in SSIS 2005 and above in Script Task as below, please note that in SSIS 2005, we should
    change PrecompileScriptIntoBinaryCode property to False and Run64BitRuntime property to False
    Public Sub Main()
            ' Add your code here
            Dim varCollection As Variables = Nothing
            Dim message As String = String.Empty
            Dts.VariableDispenser.LockForWrite("User::Message")
            Dts.VariableDispenser.LockForWrite("User::Category")
            Dts.VariableDispenser.LockForWrite("User::CntRecords")
            Dts.VariableDispenser.GetVariables(varCollection)
            'Format the query result with tab delimiters
            message = String.Format("{0}" & vbTab & "{1}" & vbLf, varCollection("User::Category").Value, varCollection("User::CntRecords").Value)
            varCollection("User::Message").Value = DirectCast(varCollection("User::Message").Value,String) + message
            Dts.TaskResult = ScriptResults.Success
    End Sub
    Drag Send Mail Task to Control Flow pane and connect it to Foreach Loop Container.
    Double-click the Send Mail Task to specify the appropriate settings, then in the Expressions tab, use the Message variable as the MessageSource Property as below:
    The final design surface like below:
    References:
    Result Sets in the Execute SQL Task
    Applies to:
    Integration Services 2005
    Integration Services 2008
    Integration Services 2008 R2
    Integration Services 2012
    Integration Services 2014
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Thanks,
    Is this a supported scenario, or does it use unsupported features?
    For example, can we call exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='b64ce7ec-d598-45cd-bbc2-ea202e0c129d'
    in a supported way?
    Thanks! Josh

  • Process All Records Returned in a SQL Report

    version 4.0.2.00.06
    Hello,
    I have an SQL Report that I've put a checkbox in the first column. I need to process all the records returned regardless if they are checked or not. If the row is checked I need to update a column in the table with one value and if it unchecked I need to update the same column with a different value.
    IF row is checked: UPDATE table SET cus_code = 'REQ' else cus_code = 'DEL'
    SELECT apex_item.checkbox(1,rownum,'UNCHECKED') " ",
    FROM table
    WHERE ...There are lots of examples of how to deal with the row if it is checked such as:
    BEGIN
        FOR i in 1..APEX_APPLICATION.G_F01.COUNT LOOP
            UPDATE emp
            SET ticked = 'Y'
            WHERE empno = APEX_APPLICATION.G_F01(i);
        END LOOP;
    COMMIT;
    END;I have not found any examples on how to process those rows that are unchecked. Can someone help me with how to do this?
    Please let me know if I'm not clear.
    Thanks,
    Joe

    Hello all,
    Thanks to everyone trying to make suggestions. Before I attempt to address some of the this suggestions I'm having other major problems. I can't even get the data to display!! Here's what I have:
    SELECT   apex_item.checkbox(1,dcu_id,'UNCHECKED') " "
         ,cust_number
         ,cust_company_name
         ,cust_address
         ,cust_city
         ,cust_state
         ,cust_postal_code
         ,decode(cls_code,'A','Active','I','Inactive','D','Active-Declining','P','Prospect') seg_descr
         ,annual_sales
         ,year_month
         ,dlr_id
         ,dlr_code
         ,cust_id
         ,drg_code
    FROM jr_customers_dm_query
        ,xmltable (trim ('''' || replace (:P29_PURCHASE_AMT, ':', ''',''') || ''''))
    WHERE round(annual_sales,0) BETWEEN regexp_substr (column_value, '\w+')  AND
                            regexp_substr (column_value, '\w+', 1, 2)        AND
          cls_code IN (trim ('''' || replace (:P29_CUST_SEG, ':', ''',''') || ''''))   AND
          drg_code IN (trim ('''' || replace (:P29_DISTANCE, ':', ''',''') || '''')) AND
          dlr_id = :P29_DLR_ID;Break down:
    P29_PURCHASE_AMT is a multi-select list with the possible values of: 0-0:1-1000:1000-5000:5000-10000:10000-25000:25000+
    P29_CUST_SEG is a multi-select list with the possible values of: A:D:I:P
    P29_DISTANCE is a multi-select list with the possible values of: 0-5:5-10:10-15:15-20:20-25
    As you know I have to parse and convert these strings to a usable format for the WHERE clause.
    The first parseing:
    xmltable (trim ('''' || replace (:P29_PURCHASE_AMT, ':', ''',''') || ''''))
    WHERE round(annual_sales,0) BETWEEN regexp_substr (column_value, '\w+')  AND
                            regexp_substr (column_value, '\w+', 1, 2)This replaces the colon with a comma and puts single quotes around the values then takes the values out and puts them into the variables of 'column_value' to be used in the BETWEEN clause.
    The next two:
          cls_code IN (trim ('''' || replace (:P29_CUST_SEG, ':', ''',''') || ''''))   AND
          drg_code IN (trim ('''' || replace (:P29_DISTANCE, ':', ''',''') || '''')) ANDThis replaces the colon with a comma and concats a single quote around the values. The conversion will be: 'A','D','I','P' and '0-5','5-10','10-15' etc.
    I know this because if you take these statements and run them against DUAL as in:
    SELECT (trim ('''' || replace ('A:D:I:P', ':', ''',''') || '''')) FROM dual;
    Result:  'A','D','I','P'The problem is that there is no data returned even though there are 10 rows in the table, jr_customers_dm_query, that contain data that satisfy the WHERE clause. If I take out all the parseing "stuff" and use actual values then the rows are returned. So there is a problem with all this parseing and I have NO idea where it is!!
    I really need some help! Then I get to try the processing problem! And I'm very going to be needing help with that!
    Thanks,
    Joe

  • No rows returned when using sql in XQuery.

    Hi all,
    I have a small table on a db with seven cols and three rows. I am doing the following xquery, but the db is returning an empty rowset when I know there sould be 3.
    <WebPage>
    for $i in sqlquery("select * from project")/row
    return
    <project>
    {$i/title}
    {$i/image}
    {$i/icon}
    {$i/version}
    {$i/start_date}
    {$i/home}
    {$i/address}
    </project>
    </WebPage>
    There is no problem with the db connection, as it is one I have used before for doing plain sql searches remotely. Does any one know why this would be happening?
    Regards,
    Simon

    Hi Bart,
    try this.....
    To execute such XQuery queries that use the sqlquery function, you would need to initialize the Java connection information in the XQueryContext before executing the query. For example, your Java program would be something like this,
    // get the connection (for example, using the thick JDBC Driver)
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn =
    DriverManager.getConnection("jdbc:oracle:@","scott","tiger");
    // create a context using that connection..
    XQueryContext ctx = new XQueryContext(conn);
    // create a string from the file
    Reader strm = new StringReader(
    "FOR $i IN sqlquery(\"select * from scott.emp\")/ROW "+
    " RETURN <EMP empno=\"{$i/EMPNO}\">$i/ENAME,$i/SALARY</EMP>");
    // prepare the query
    PreparedXQuery xq = ctx.prepareXQuery(strm);
    // get a resultset
    XQueryResultSet rset = xq.executeQuery();
    while (rset.next())
    XMLNode node = rset.getNode(); // get result nodes
    System.out.println(" NODE "+ node.getNodeName());
    node.print(System.out);
    source:==>http://otn.oracle.com/sample_code/tech/xml/xmldb/jxqi.html
    Good luck
    Achim

  • Changing Row color of standard SQL report

    Hi,
    I am trying to follow this post to change the color of a row in APEX SQL report. Change Colour of Row - Oracle APEX SQL Report
    It's a bit outdated, and trying to figure out how to get to this page: http://img7.imageshack.us/img7/4782/columntemplate.jpg in APEX 4.2 where I can conditionally set background color.
    I am using theme 13 (legacy) and made a copy of the report region. Edited it but cannot find an equivalent section of that apex 3.1 screenshot.
    Any help appreciated.

    William Wallace wrote:
    I sure was :) Cheers for pointing it out.
    Just another question, there are 4 options for the #COLUMN_VALUE# which I have background color conditionally (just like in that screenshot) based on one of the column values. The column can be of 1..5 values, however I only have 4 conditions to work with in the template editor.
    So what APEX is doing is since it can't find a 5th matching condition, it picks the very first one and applies it on it (even though the condition doesn't match).
    Is there anyway I can incorporate a 5th option/condition for column templates? Cheers.Not using that technique. There are a couple of options: another template-based approach using a custom named column report template, or using jQuery. I generally prefer the template method as everything runs on the server.
    1. Start by including a column containing the condition logic to generate a class value in the report query:
    select
            , case
                when sal < 1000 then 'low'
                when sal between 1000 and 2000 then 'medium'
                when sal > 2000 then 'high'
              end sal_class
    from
              empThen create a custom named column report template:
    2. Go to: Shared Components > Templates > Create
    3. In the wizard select: Report > From Scratch
    4. Enter/select:
    Name: [Name for this template]
    Theme: [Your current theme]
    Template Class: Custom 1
    Template Type: Named Column (row template)
    5. Click Create.
    6. Click the Status Report link in the Templates report.
    7. Enter the following properties:
    Row Template 1
    <tr class="#SAL_CLASS#"><td>#1#</td><td>#2#</td>...include a cell with a column substitution for every column in your report...</tr>i.e. the column with the conditional logic in the query is used to apply the required class to the row.
    Before Rows
    <!-- Copy the Before Rows definition from the Standard report template for your current theme and paste here -->
    <tr><th>#1#</th><th>#2#</th>...include a header with a column substitution for every column in your report...</tr>
    After Rows
    <!-- Copy the After Rows definition from the Standard report template for your current theme and paste here -->Add CSS to style the rows:
    8. Edit the Page CSS Attributes for the report page:
    Inline
    tr.low td { background-color: yellow; }
    tr.medium td { background-color: white; }
    tr.high td { background-color: red; }9. Change the report to use the new template.
    For the alternative jQuery approach, Tom created an example for this thread: +{thread:id=2487955}+

  • Displaying connect by indent in updatable sql report

    We have several normal reports that indent the identifying number field in connect by order. We also would like to do this in updatable sql reports, but they reject our attempts to use    for the indent characters in our rpad statement.

    Please see the other message sent with this. Here is the entire sql with amperands and ; removed fromt he nbsp characters.
    SELECT rpad(' ', 2 * (LEVEL - 1) + 1, 'nbspnbsp') || pr2.projectno, pr2.NAME,
    pr2.person_months, pr2.percent_staffed,pr2.test_months, pr2.testpercent_staffed
    FROM projects_view pr2
    START WITH pr2.projectno IN
    (Select pr.projectno from projects_view pr
    where pr.num_children>0 AND
    pr.projectno like NVL(:p205_projectno,'%') and
    pr.name like NVL(:p205_name,'%') and
    pr.releaseno LIKE NVL(:p205_release,'%') AND
    pr.delete_flag='N')
    CONNECT BY pr2.parent_projectno = PRIOR pr2.projectno

  • Question about number of rows returned in PL/SQL , SQL

    The Child Table has 3 Million plus records, but the loaded table only brings back
    approximately 1.2 Million records. Is there anything on the Oracle side that would limit the number of rows returned.

    Would it be possible to post a test case that explains what you're seeing? It sounds like you are indicating that
    SELECT COUNT(*) FROM <<some table>>returns 3 million rows. When some process goes to load a Teradata table by extracting all the information from this Oracle table, the Teradata table ends up with only 1.2 million rows. Is that correct?
    If so,
    - What is the ETL process?
    - Is it possible that the ETL process is encountering an error midway through?
    - Is it possible that the ETL process is extracting a subset of the data through a WHERE clause?
    - Is the ETL process logging in as the same Oracle user you're using to do the COUNT(*)?
    Justin

  • How to capture all the rows returned from a sql select query in CPO

    Hi,
      I am executing an sql select query which returns multiple rows. I need to capture the values of each row to specific variables. How do I proceed.
    Thanks,
    Swati

    The select activities  ("Select from Oracle," Select from SQL Server," etc.) against database already return tables.  Use one of the database adapters to do your select, and it will already be in a table form.  Just put your query in the select and identify the columns in your result table. The online help or the database adapter guides in the product documentation can help.

  • IR: Display single row of data over multi report rows.

    In an interactive report, is it possible to display the data from one database row over two or more displayed rows on a page?

    Corvette Captain wrote:
    In an interactive report, is it possible to display the data from one database row over two or more displayed rows on a page?Yes. Create the required structure using the Detail View properties.
    Users can switch between views using the view controls. You can display the report in Detail View by default via a Dynamic Action: +{thread:id=2187972}+

  • Want to display "no data Return" message for empty report

    HI all
    I have a requirement where i should show a message saying "No data Returned" under the empty table in the webI report.
    I know that we should use function
    =If(NumberOfRows([Data Provider Name])=0;"NO Data Available")
    I will create a empty cell and include this formula for that cell, but any one please tell me what exactly is the Data Provider Name? Is it the name of the univerese or something else? where can i get the Data provider name?

    Data Provider Name is the name of your query.  By default its name is Query 1.
    =NumberOfRows([Query 1])
    Or you may have changed its name when you edited the query in the query panel, so that's the name you have to use there
    For example:
    =NumberOfRows([My Query])
    If you have a lot of Queries in your report they may be Query 1, Query 2, Query 3 and so.
    Edited by: PadawanGirl on Feb 18, 2011 3:33 PM

  • 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.

  • Number of rows returned for a report

    I want to create reports on serveral tables, the number of rows in these tables varies a lot (5, 5000, and the other one can have 10000+ rows).
    In the Reports Attributes page, is there a way to set the max number of rows return to the number of rows of the table? For example, for a table that has 10000 rows now, may grow to 20000 rows in the near future. If I specify the "Max Row Count" to 20000, the number may be outgrown yet again soon. If I can specify "Max Row Count" to "Current number of rows in the table" then this problem will not happen. Can it be done?

    that "Max Row Count" attribute is used to limit the number of rows returned by a htmldb report region. in your case it sounds as if you want to show all available rows all the time. in that case you'd be fine to just put a very large number into that field like 4million. that way you'd always show all your rows.
    hope this helps,
    raj

  • Custom "no row returned" message

    hi all,
    is there a way to change the "no row returned " message in the report?
    I want to translate it in french!
    thks for help

    You can try to do such thing : create your query like
    select a1 f1,a2 f2, ... from table
    UNION
    select null f1,null f2,... from dual
    In this case if you don't have real records you get an empty record, so the mentioned message diappears.

  • Display TTITLE in SQL*Plus when no rows returned

    I need a SQL*Plus query that would display the TTITLE with Date. My query looked like this at first:
    column TODAY noprint NEW_VALUE p_date
    set feedback off
    select to_char(sysdate, 'mm/dd/yyyy') today from dual;
    set feedback on
    ttitle left 'query.sql' -
    center 'Department Listing ' -
    right 'Date: ' p_date skip 1
    select dept_code, dept_name
    from department
    where dept_code between 200 and 300
    When I run this query, if there's data returned, the title would display on every page.
    When there's no rows selected, the title would NOT display.
    So I moved the ttitle statements to ABOVE the select date section. When there's no rows selected the title would be displayed, where there's data selected, the title would be display TWICE on the first page which is very annoying.
    Then I added TTITLE OFF after the select date section and the query looked like this:
    column TODAY noprint NEW_VALUE p_date
    ttitle left 'query.sql' -
    center 'Department Listing ' -
    right 'Date: ' p_date skip 1
    set feedback off
    select to_char(sysdate, 'mm/dd/yyyy') today from dual;
    set feedback on
    ttitle off
    select dept_code, dept_name
    from department
    where dept_code between 200 and 300
    when no rows selected, the title displayed.
    when rows selected, the title displayed, ONLY ON THE FIRST PAGE.
    Does anyone have any creative ideas to get the ttitle to display: with or without return results, ONCE and on EVERY page?
    Thanks in advance!!!
    Jane

    Hi Jane,
    Just check out this answer might helps u.
    In the final code what u have written u placed the ttitle off above the sql statement for dept.
    Just note these points
    1.U r telling the TTITLE OFF before SQL For Department
    2.In both cases(With Data/Without Data) u r able to see the title once that is of select statement for date.
    so there is no title for Select statement for department
    What ur code telling is U have written a TTITLE that is for Selection of Date not for the Selection of department.
    So in both cases u r getting the title once.
    Put the TTITLE OFF at the end that is after Select stmt of department
    then u will get title for each page.
    In the first Script u told that it is displaying twice(annoying)
    It will display like that only coz there are two select statements in ur Script.
    TTITLE means it will display once on each page per query.
    one is for select statement of date(it will display once because that query result is max of one line)
    second is for select statement for Department(it will display one title in each page)
    so u will find two titles on first page.
    Hope this will clear u
    Revert back for any more clarifications
    Regards
    Kiran

  • Portal report - If rows returned are 1 greater than max,last row not shown

    We are experiencing what appears to be a bug with reports developed from a locally built Provider in Portal...
    If my "maximum rows to return" is set to 20, and my search returns 21 rows/results, the "next" button to navigate to the last row does not appear. Therefore, the last row is not returned to the user....
    We have been able to duplicate this with any number... For example, if we set the "max rows to be returned" to 59, and our results come back with 60 rows, neither the "next" button or last row are returned...
    Bug by chance?
    Thanks in advance for any help offered....
    ~Chris

    Hi Varsha,
    Please pay attention when you are requesting motnly period for
    start date : 1st July 2008
    end date : 1st july 2008
    After saving the period is changed to
    Start Date : 7/1/2008
    End Date  : 7/31/2008
    When you are requesting weekly period for the same interval, after sving the dates are changed again, according
    you settings of first day of the week. It it is Monday it could be as following
    Start Date : 6/30/2008
    End Date  : 7/6/2008
    So you are asking data for not quite the same period.
    Do you have data for monthly period in that interval?
    Regards,
    Victoria Gur

Maybe you are looking for