Query in Reporting?In result no., of entries should be displayed?

hello all
Need a result like no., of entries in a report?
Like I have a report in that Quantity and Customer number  is my Infobjects
if for c001 customer if i have 5 entries(5 quantites) like(10,20,30,40,50) in result it should display as "5" not the total "150"?
how to do this
regards
balji

Hi,
right click on Key figure (in BEx query designer)--> calacule result as --> counting all values.
hope it helps
regards
VC

Similar Messages

  • Report Execution time in NQQuery.log should be display in Milliseconds

    Report Execution time in NQQuery.log should be display in Milliseconds.
    For Example :
    --- Logical Query Summary Stats: Elapsed time 0, Response time 0, Compilation time 0 (seconds)
    Can we see the logical Query Summary Stats in milliseconds?
    If so Where should i cofigure to populate this.

    No. If you query comes in less that 1 second then you got nothing to worry about. I haven't seen a single DWH where users would worry about queries returning in milliseconds.

  • Unable to create report. Query produced too many results

    Hi All,
    Does someone knows how to avoid the message "Unable to create report. Query produced too many results" in Grid Report Type in PerformancePoint 2010. When the mdx query returns large amount of data, this message appears. Is there a way to get all
    the large amount in the grid anyway?
    I have set the data Source query time-out under Central Administration - Manager Service applications - PerformancePoint Service Application - PerformancePoint Service Application Settings at 3600 seconds.
    Here Event Viewer log error at the server:
    1. An exception occurred while running a report.  The following details may help you to diagnose the problem:
    Error Message: Unable to create report. Query produced too many results.
            <br>
            <br>
            Contact the administrator for more details.
    Dashboard Name:
    Dashboard Item name:
    Report Location: {3592a959-7c50-0d1d-9185-361d2bd5428b}
    Request Duration: 6,220.93 ms
    User: INTRANET\spsdshadmin
    Parameters:
    Exception Message: Unable to create report. Query produced too many results.
    Inner Exception Message:
    Stack Trace:    at Microsoft.PerformancePoint.Scorecards.Server.PmServer.ExecuteAnalyticReportWithParameters(RepositoryLocation analyticReportViewLocation, BIDataContainer biDataContainer)
       at Microsoft.PerformancePoint.Analytics.ServerRendering.OLAPBase.OlapViewBaseControl.ExtractReportViewData()
       at Microsoft.PerformancePoint.Analytics.ServerRendering.OLAPBase.OlapViewBaseControl.CreateRenderedView(StringBuilder sd)
       at Microsoft.PerformancePoint.Scorecards.ServerRendering.NavigableControl.RenderControl(HtmlTextWriter writer)
    PerformancePoint Services error code 20604.
    2. Unable to create report. Query produced too many results.
    Microsoft.PerformancePoint.Scorecards.BpmException: Unable to create report. Query produced too many results.
       at Microsoft.PerformancePoint.Scorecards.Server.Analytics.AnalyticQueryManager.ExecuteReport(AnalyticReportState reportState, DataSource dataSource)
       at Microsoft.PerformancePoint.Scorecards.Server.PmServer.ExecuteAnalyticReportBase(RepositoryLocation analyticReportViewLocation, BIDataContainer biDataContainer, String formattingDimensionName)
       at Microsoft.PerformancePoint.Scorecards.Server.PmServer.ExecuteAnalyticReportWithParameters(RepositoryLocation analyticReportViewLocation, BIDataContainer biDataContainer)
    PerformancePoint Services error code 20605.
    Thanks in advance for your help.

    Hello,
    I would like you to try the following to adjust your readerquotas.
    Change the values of the parameters listed below to a larger value. We recommend that you double the value and then run the query to check whether the issue is resolved. To do this, follow these steps:
    On the SharePoint 2010 server, open the Web.config file. The file is located in the following folder:
    \Program Files\Microsoft Office Servers\14.0\Web Services\PpsMonitoringServer\
    Locate and change the the below values from 8192 to 16384.
    Open the Client.config file. The file is located in the following folder:
    \Program Files\Microsoft Office Servers\14.0\WebClients\PpsMonitoringServer\
    Locate and change the below values from 8192 to 16384.
    After you have made the changes, restart Internet Information Services (IIS) on the SharePoint 2010 server.
    <readerQuotas
    maxStringContentLength="2147483647"
    maxNameTableCharCount="2147483647"
    maxBytesPerRead="2147483647"
    maxArrayLength="2147483647"
                  maxDepth="2147483647"
    />
    Thanks
    Heidi Tr - MSFT
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Select Query for Report

    Hi All
    I have a table called Agent. Each Agent processes requests.
    So accordingly Request is another table.
    Now the Agent can process the request successfully, fail or it could be
    in progress.
    So accordingly I have a status column in the Request table which can have the following values
    New - when the request is allocated to the agent
    Open- When the agent opens the request
    Action- when the agent acted upon the request
    Sold - when the agent was successful in processing the request
    Fail - when the agent could not process the request
    In the Request table there is column called requestDate which is the
    date when the Request was first inserted (i.e when its New)
    Now whenever the agent acts upon the request from the front end
    the status change is logged in a RequestLog table.
    So when the agent changes the status to Open, an entry is logged into
    RequestLog table.
    So when the agent open the request an entry in the RequestLog table
    would go with the status as open , the reference of the requestId &
    the date on which the status is changed
    Similar entries will be logged for each request when the agent acts on
    the respective requests like if its Sold then the status will be sold,
    the date of sale & the corresponding request Id will be logged into the
    RequestLog table.
    In the Request table the status will be changed to "Open" or "Sold" but the
    requestDate will not change & it will remain the date when it was inserted
    Now I want to generate a Report which shows the list of all agents within a state
    with all total number of requests they have handled, how many are in Opened status,
    how many are in Sold status & how many are in Fail status. I also have to show the
    average time(in days) it took for each agent to Open the request, make the sale or qualify it
    as Fail. This average time I want it for an agent & not request specific.
    & In the end I have to show the grand total of all the requests handled by all the agents,
    grand total of opened status requests,grand total of Sold status requests,grand total of Fail status requests as well as the total average time it took to Open ,total average time it took to sale & total average time it takes to Fail
    I have dabbled with simple SQL but not a complex report type like above. So I would need help from all you experts.
    Here is what I plan to do
    my from clause would include the Agent, Request, RequestLog table
    where Request.requestdate between <fromDate> and <toDate>
    group by agent.agentname,
    Select would have count(agent.requestid),
    Now how do i show the list of Open requests, sold requests & fail requests in different columns since all these values are in the same column.
    Also I am aware of the average fnction but I need help on how to use the same in such a scenario.
    Do post your thoughts on the same.
    Regards

    Hi All
    I have made some queries to fetch the Report data. I would want you to post your comments on the same.
    This is my first query which returns the total count of request per dealer, how much are in open, sent & dead state & total per status.
    select AGENT.COMPANY_NAME,count(REQUEST.REQUEST_ID) TOTAL ,
    sum(decode(REQUEST.status,'Open',1,0)) OPEN,
    sum(decode(REQUEST.status,'Sent',1,0)) SENT,
    sum(decode(REQUEST.status,'Dead',1,0)) DEAD
    from AGENT, REQUEST
    where
    AGENT.STATE='ACT'
    and REQUEST.REQUEST_TYPE='B'
    and REQUEST.CONFIRMATION='Y'
    and AGENT.DEALER_ID = REQUEST.DEALER_NUMBER
    group by grouping sets(AGENT.COMPANY_NAME, ())
    Then I have to retrieve the average number of days it takes to change the request to Open, average number of days it takes to change the request to Sent & average number of days it takes to change the request to Dead
    per Agent. The base date is stored in REQUEST table (request_date column) & the subsequent change of status is stored in activity_date column
    of ACTIVITY table
    Here is what I do get the average number of days it takes to change the status for the Agent
    select AGENT.COMPANY_NAME,
    avg( decode (REQUEST.status,'Open',ACTIVITY.ACTIVITY_DATE - REQUEST.REQUEST_DATE,0)) AVG_OPEN,
    avg( decode (REQUEST.status,'Sent',ACTIVITY.ACTIVITY_DATE - REQUEST.REQUEST_DATE,0)) AVG_SENT,
    avg( decode (REQUEST.status,'Dead',ACTIVITY.ACTIVITY_DATE - REQUEST.REQUEST_DATE,0)) AVG_DEAD
    from REQUEST, ACTIVITY, AGENT
    where
    AGENT.STATE='ACT'
    and REQUEST.REQUEST_TYPE='B'
    and REQUEST.CONFIRMATION='Y '
    and REQUEST.dealer_number = AGENT.DEALER_ID
    and REQUEST.STATUS = ACTIVITY.STATUS
    group by grouping sets(AGENT.COMPANY_NAME, ())
    I hope this is the right way for calculating average number of days
    Since most part of the queries is the same
    I tried to merge both the queries into one because I need to render the report in that fashion. But the moment I merge the query its giving absurd results.
    Do post your thoughts on the same
    Regards

  • SQL Query (updateable report) Region - Conditionally Hide and Set Values

    SQL Query (updateable report) Region - Conditionally Hide and Set Values
    Outline of requirement :-
    Master / Detail page with Detail updated on same page using SQL Query (updateable report).
    The detail region has the following source
    SELECT item_id,
           contract_id,
           CASE WHEN hardware_id IS NOT NULL THEN
                   'HA'
                WHEN backup_dev_id IS NOT NULL THEN
                   'BD'
                WHEN hardware_os_id IS NOT NULL THEN
                   'HS'
           END item_type,
           hardware_id,
           backup_dev_id,
           hardware_os_id
    FROM   "#OWNER#".support_items
    WHERE  contract_id = :P26_CONTRACT_IDThe table support_items implements arced relationships and has the following columns
    CREATE TABLE SUPPORT_ITEMS
      ITEM_ID         NUMBER                        NOT NULL,
      CONTRACT_ID     NUMBER                        NOT NULL,
      HARDWARE_ID     NUMBER,
      BACKUP_DEV_ID   NUMBER,
      HARDWARE_OS_ID  NUMBER
    )A check type constaint on support_items ensures that only one of the fk's is present.
          (    hardware_id    IS NOT NULL
           AND backup_dev_id  IS NULL
           AND hardware_os_id IS NULL
    OR    (    hardware_id    IS NULL
           AND backup_dev_id  IS NOT NULL
           AND hardware_os_id IS NULL
    OR    (    hardware_id    IS NULL
           AND backup_dev_id  IS NULL
           AND hardware_os_id IS NOT NULL
          )    Hardware_Id is a FK to Hardware_Assets
    Backup_dev_id is a FK to Backup_Devices
    Hardware_os_id is a FK to Hardware_op_systems
    The Tabular Form Element based on item_type column of SQL query is Displayed As Select List (based on LOV) referencing a named list of values which have the following properties
    Display Value     Return Value
    Hardware Asset    HA
    Backup Device     BD
    Computer System   HSThe Tabular Form Elements for the report attributes for hardware_id, backup_dev_id and hardware_os_id are all Displayed As Select List (Based on LOV).
    What I want to do is only display the Select List for the FK depending on the value of the Select List on Item Type, e.g.
    Item_Type is 'HA' then display Select List for hardware_id, do not display and set to NULL the Select Lists for backup_dev_id and hardware_os_id.
    Item_Type is 'BB' then display Select List for backup_dev_id, do not display and set to NULL the Select Lists for hardware_id and hardware_os_id.
    Item_Type is 'HS' then display Select List for hardware_os_id, do not display and set to NULL the Select Lists backup_dev_id and hardware_id.
    There are properties on elements to conditionally display it but how do we reference the values of the SQL query Updateable region? they are not given a page item name?
    Also on the Tabular For Elements there is an Edit tick against a report item - however when you go to the Column Attributes there is not a property with which you can control the Edit setting.
    What's the best way of implementing this requirement in APEX 3.1?
    Thanks.

    >
    Welcome to the forum: please read the FAQ and forum sticky threads (if you haven't done so already), and update your profile with a real handle instead of "user13515136".
    When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
    With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.
    I have a multi-row region that displays values and allows entries in a number of fields.Provide exact details of how this has been implemented. (An example on apex.oracle.com is always a good way to do this.)
    I should like the fields to be conditional in that they do not permit entry, but still display, if certain conditions apply (e.g. older rows greyed out). Can this be done? Almost anything can be done, often in multiple ways. Which are appropriate may be dependent on a particular implementation, the skills available to implement it, and the effort you're willing to expend on it. Hence it's necessary to provide full details of what you've done so far...

  • Get a insert session value for SQL query at report

    Hi friends
    I created a global temp table and procedure to support web search form.
    and a search result report. The procudure
    gets search result from multip tables and
    insert into temp table --recordsearch. I can get value from temp table  by call procedure
    at SQL*Plus.
    However, I can not get this value by web report.
    How can I get this insert session value and pass to SQL query for report?
    Thanks,
    Newweb
    CREATE GLOBAL TEMPORARY TABLE recordsearch
    (emp_id          VARCHAR2(200),
    ssn               VARCHAR2(9),
    fname          VARCHAR2(200),
    lname           VARCHAR2(200),
    m_name          VARCHAR2(200)
    ) ON COMMIT PRESERVE ROWS;

    it possible that your web form does not have a persistent, dedicated connection. if you have connection pooling for example, multiple sessions will see the same instance of the GTT, so if one deletes it, then nobody sees it (or you can see others data). if the connections are not persistent, then they can disconnect between calls, deleting the GTT table.

  • Sql query in report/source

    Is possible use this kind of select select a,(select b from b) from b
    in sql query in report/source?

    Pretty much any valid select statement can be used.
    If it works in SQL*Plus, then it should work in Application Express.
    I think your example would not be valid if table b has more than one row.
    A scalar subquery (like your "select b from b") must only return a single value.
    SQL>  select ename, (select job from emp) from emp e;
    ORA-01427: single-row subquery returns more than one rowIf your subquery can be restricted to return one value, then it should work.
    SQL>  select ename, (select job from emp where empno = e.empno) job from emp e;
    ENAME      JOB
    KING       PRESIDENT
    BLAKE      MANAGER
    CLARK      MANAGER
    JONES      MANAGER
    SCOTT      ANALYST
    FORD       ANALYST
    SMITH      CLERK
    ALLEN      SALESMAN
    WARD       SALESMAN
    MARTIN     SALESMAN
    TURNER     SALESMAN
    ADAMS      CLERK
    JAMES      CLERK
    MILLER     CLERK
    14 rows selectedBut is that the kind of result you were looking for?

  • Liabilities Ageing report not acknowledging old journal entries

    Hello,
    I have just upgraded a system from 2007A SP00 PL48 to 8.8 SP00 PL17.  When I ran the Vendor Liabilities report in 8.8 I noticed that one of the business partners has a journal entry and an open invoice.  The journal entry has no value when displayed in the report however when i open the journal up, it is showing a debit for the exact same amount as the invoice, but was created as a result of a foreign exchange gain and has not been reconciled against the invoice.  The ageing report is showing that the invoice is still outstanding and needs to be paid.  However when I run exactly the same report in version 2007, the two amounts are seen to conteract each other and therefore no oustanding amount is shown in the ageing report for this customer.  When I reproduce the scenario in 8.8 with a new invoice and new journal entry, the two transactions are shown to counteract and no outstanding balance is displayed.
    Does anyone know if there is a problem with old journal entries being recognised in the ageing report in version 8.8 or specifically journals created as a result of foreign exchange rate losses/gains?
    Many thanks,
    Kate

    Hi Kate,
    We recently upgraded to 8.8 and in reviewing the aging reports realized some manually reconciled entries had to be redone.
    In particular, it seemed to be for entries where foreign currencies were involved. There is a new field in the Internal Rec window in the top left corner - select it and the entries with only SC value will then appear (i.e. you will see all unreconciled entries) along with other entries.
    HTH,
    Heather

  • Setting the cell width in a Tabular Form (SQL Query (updateable report) )

    version 3.2.1
    I have a Tabular Form (SQL Query (updateable report) ) and I have a column that is a VARCHAR2(4000) that when displayed extends the cell to the full length (which of course makes sense).
    How can I set the width of this cell to something like 30 or 50 and wrap the contents?
    Thanks,
    Joe

    Scott,
    Thank you for replying.
    Your suggestion kinda worked. I say kinda because when the report is first displayed the cell is the full width and appears to ignore the width setting. There is a Select List on the report to restrict some of the data that is displayed. When a selection is made from this Select List, it appears that the cell width is then adjusted to what was set, but not for every selection from this Select List.
    I made the width entry in Tabular Form Element - Element Width
    Any idea why the width setting is ignored?
    Thanks,
    Joe

  • WMI Query to SCCM 2012 results zero results in c#

    In 2007 this works without issues, however in 2012 when attempting the 2nd query it returns zero results.  However if I do this manually I can produce results...Here is my code:
    using (WqlConnectionManager connection = Connect(getServer))
       string query = "select * from SMS_ObjectContainerItem WHERE ContainerNodeID='" + ProfileID + "'";              
       foreach (IResultObject getobject in connection.QueryProcessor.ExecuteQuery(query))
         getPackageID = getobject["InstanceKey"].StringValue;
         query = "select * from SMS_Collection WHERE CollectionID='" + getPackageID + "'";
    **This is where it will return zero results**
         foreach (IResultObject searchID in connection.QueryProcessor.ExecuteQuery(query))
            CMProfiles profile = new CMProfiles();
            profile.Name = searchID["Name"].StringValue;
            profile.ID = getPackageID;
            results.Add(profile);
    I'm pulling my hairs trying to understand by the 2nd query is not returning any results. When this works fine in SCCM 2007

    What you are using here are the SDK libraries, which are admittedly very thin wrappers around WMI, but not quite.  Have you tried implementing this directly using WMI?  I have written software that manipulates 2007 / 2012 and eventually found that
    the SDK libraries just sort of got in my way, so now I do all of my interactions with SCCM directly with WMI and forgoe the SDK libraries.
    Before I changed over, I did find that there are some oddities in using the SDK.  What I eventually found that worked for me was to bind to the 2007 SDK libraries, deliver them with my application and use the 2007 libraries regardless of if I was connecting
    to 2007 or 2012.  What I found was that I would run into issues using the 2012 libraries to talk to 2007, but the 2007 libraries would work fine with both.
    I have tested your queries, directly using WMI and PowerShell on a 2012 server and they work fine.  I am presuming that the folder that you are attempting to access is a Device Collection folder.
    Once again, I would suggest using WMI directly, especially if making a product that will work with 2007 and 2012; you will be a much happier person.
    It would be greatly appreciated if you would mark any helpful entries as helpful and if the entry answers your question, please mark it with the Answer link.

  • What is query and reporting

    hai sap gurus..
    what is difference the query and reporting
    in an interview i have been asked.
    how many queries and how many reporting  did you created.

    Hi Naren,
    SAP Query
    An ABAP Workbench tool that enables users without knowledge of the ABAP programming language to define and execute their own reports.
    In ABAP Query, you enter texts and select fields and options to determine the structure of the reports. Fields are selected from functional areas and can be assigned a sequence by numbering.
    ABAP Query offers the following types of reports:
    Basic lists
    Statistics
    Ranked lists
    Query used for short run based i.e the format of the report output you can change frequently.
    Report (CA) 
    A compilation of data for a company or group of companies in the form of a table or list.
    An evaluation is the result of executing a report. It can be either displayed on the screen or sent to a printer.
    Here ABAP programing language will be used to execute the report.
    Report used for long run it is standard output we can,t change frequently.
    I hope it will clear for you,
    Regards,
    Murali.

  • Transport of infoset Query through Report RSAQR3TR

    Dear Hcm Gurus
    I have created query through sq01 and change functional area sq02 as per requirement in this query
    i have created additional fields in infoset in which i also assigned abap field code on newly created  data fields
    i also assigned new data fields to relavent field group as well
    but when i export and import as per mentioned procedures , additional data field are not imported in target client
    i have follow steps as mentioned
    Step 1
    Run RSAQR3TR in 'old' system. Select EXPORT and specify the objects to be transported. (System includes these in an automatically created transport request)
    Step 2.
    Release this transport and request it be transported to 'new' system. (This results in the entries being populated in transport table AQTDB in 'new' system).
    Step 3.
    Run RSAQR3TR in 'new' system. Select IMPORT and tick the Overwrite checkbox. Specify the transport number in the field labelled 'dataset with imports'.
    Kindly guide me urgently that how additional fields are transported in target client
    Regards
    Barket Ali Zafar
    SAP HCM Consultant
    Siemens Pakistan
    +92-0300-5521524

    yes
    but my question is ? that additional data field defineds in functional area /infoset are not importing ?
    Kindly guide me urgently

  • Report Designer Result Row question

    Hello Gurus
    I read that in the report desinger you can grab the result row feilds from the inserted query and place it another report section but where do get that i don't see those cells showing up anywhere in the feild catalog.
    basically i have two queries in the report designer and i want to use the result rows from both and divide them to get another result row
    any ideas how can i do that
    thanks

    Well i have two queries inserted and the first problem is for the first query there is no footer section and the result rows are displaying as part of detail. I can't figure that out . Although the chararchterstic that i have there is a heirarchy unless thats a problem.
    and for the second query i do have result row show up on yellow when i run it and in report structure i do see the group0 , then group header group1, and then footer so where is the result row the footer row or in detail. And once i have it what do i jst drag the row into the row in added report section.
    please its urgent
    thanks

  • Query Based Report

    HI All,
    I have tried to make query to get the result of quotations against customer and sales order against but inorder to reflect it as per customer total i have used union all option.
    THE ISSUE IS I AM UNABLE TO PICK UP THE TOTAL AMOUNT AS PER CUSTOMER SAY CUSTOMER A HAVING 2 QUOTATIONS OF 1000 & 2000 SO I NEED TOTAL TO REFLECT AS PER CUSTOMER.ALSO TO MAKE IT MANAGEMENT REPORT I HAVE TO ADD THE COUNT OF TOTAL QUOTATIONS MADE AS PER CUSTOMER AND THE Number of
    Sales Orders Created     Value of Sales Orders     % Quotes/Sales Orders     
    Select  QuoteDate,CustomerName,QuoteTotal,QuoteNum,SOdate,SONum,SOTotal
    from (
    Select distinct  T0.[DocDate]QuoteDate, convert (varchar, T0.[CardName]) CustomerName,T0.[DocNum] QuoteNum, T0.[DocTotal] as QuoteTotal,T4.[DocNum] SONum,T4.[DocDate] SODate, T4.[DocTotal] as SOTotal
    From OQUT t0 INNER JOIN [dbo].[QUT1]  T1 ON T0.DocEntry = T1.DocEntry
    left join [dbo].[RDR1]  T3 on t0.docEntry=T3.Baseentry left JOIN ORDR T4
    ON T3.DocEntry = T4.DocEntry where T0.[DocDate] >=[%0] AND  T0.[DocDate] <=[%1]
    Group By T0.[DocNum],T0.[DocDate],(T0.[DocTotal]),T0.[CardName], T4.[DocNum],T4.[DocDate],(T4.[DocTotal])
    union all
    Select Distinct  null DocDate,convert (varchar, T0.[CardName]) + ' ' +  'Total' CustomerName,null DocNum,null DocTotal ,null DocDate,null DocNum, null DocTotal
    From OQUT t0 INNER JOIN [dbo].[QUT1]  T1 ON T0.DocEntry = T1.DocEntry
    left join [dbo].[RDR1]  T3 on t0.docEntry=T3.Baseentry left JOIN ORDR T4
    ON T3.DocEntry = T4.DocEntry
    where T0.[DocDate] >=[%0] AND  T0.[DocDate] <=[%1]
    Group By T0.[DocNum],T0.[CardName],T4.[CardName],T4.[DocNum]) a
    Order By
    CustomerName
    Thanks-
    Mona.

    Hi,
    It will not fulfill customers requirement.
    In the above query posted by me refer below example-
    Date               CustomerName                      Doc Num                                                                      Doctotal
    07/03/2012           ABC                                       1                                                                100
    07/03/2012           ABC                                       2                                                                 200
    Null                      ABC Total                            null                                                                                300
    Is it not possible to get 300 on query made by me.
    Thanks-
    Mona.

  • Query to Report on Parallel Jobs Running

    Morning!
    I would like to get a query that reports on my parallel jobs.
    For each minute that a procedure is running I would like to know what stages are running.
    I log the whole procedure in a table called run_details and the start and end of each stage in a table called incident.
    I'm running Oracle 9i
    Here is some sample data based on 2 threads Expected output at the bottom
    SQL>CREATE TABLE run_details
      2  (run_details_key  NUMBER(10)
      3  ,start_time       DATE
      4  ,end_time         DATE
      5  ,description      VARCHAR2(50)
      6  );
    SQL>CREATE TABLE incident
      2  (run_details_key NUMBER(10)
      3  ,stage           VARCHAR2(20)
      4  ,severity        VARCHAR2(20)
      5  ,time_stamp      DATE
      6  );
    SQL>INSERT INTO run_details
      2  VALUES (1
      3         ,TO_DATE('08/10/2007 08:00','DD/MM/YYYY HH24:MI')
      4         ,TO_DATE('08/10/2007 08:10','DD/MM/YYYY HH24:MI')
      5         ,'Test'
      6         );
    SQL>INSERT INTO incident
      2  VALUES (1
      3         ,'Stage1'
      4         ,'START'
      5         ,TO_DATE('08/10/2007 08:00','DD/MM/YYYY HH24:MI')
      6         );
    SQL>INSERT INTO incident
      2  VALUES (1
      3         ,'Stage1'
      4         ,'END'
      5         ,TO_DATE('08/10/2007 08:08:53','DD/MM/YYYY HH24:MI:SS')
      6         );
    SQL>INSERT INTO incident
      2  VALUES (1
      3         ,'Stage2'
      4         ,'START'
      5         ,TO_DATE('08/10/2007 08:00','DD/MM/YYYY HH24:MI')
      6         );
    SQL>INSERT INTO incident
      2  VALUES (1
      3         ,'Stage2'
      4         ,'END'
      5         ,TO_DATE('08/10/2007 08:04:23','DD/MM/YYYY HH24:MI:SS')
      6         );
    SQL>INSERT INTO incident
      2  VALUES (1
      3         ,'Stage3'
      4         ,'START'
      5         ,TO_DATE('08/10/2007 08:04:24','DD/MM/YYYY HH24:MI:SS')
      6         );
    SQL>INSERT INTO incident
      2  VALUES (1
      3         ,'Stage3'
      4         ,'END'
      5         ,TO_DATE('08/10/2007 08:10','DD/MM/YYYY HH24:MI')
      6         );
    SQL>select * from incident;
    RUN_DETAILS_KEY STAGE      SEVERITY   TIME_STAMP
                  1 Stage1     START      08/10/2007 08:00:00
                  1 Stage1     END        08/10/2007 08:08:53
                  1 Stage2     START      08/10/2007 08:00:00
                  1 Stage2     END        08/10/2007 08:04:23
                  1 Stage3     START      08/10/2007 08:04:24
                  1 Stage3     END        08/10/2007 08:10:00  So stages 1 and 2 run in parallel from 08:00, then at 08:04:23 stage 2 stops and a second later stage 3 starts.
    set some variables
    SQL>define start_time = null
    SQL>col start_time new_value start_time
    SQL>define end_time = null
    SQL>col end_time new_value end_time
    SQL>
    SQL>SELECT start_time-(1/(24*60)) start_time
      2        ,end_time
      3  FROM   run_details
      4  WHERE  run_details_key =  1;
    START_TIME          END_TIME
    08/10/2007 07:59:00 08/10/2007 08:10:00Get every minute that the process is running for:
    SQL>WITH t AS (SELECT TRUNC(TO_DATE('&start_time','dd/mm/yyyy hh24:mi:ss'),'MI') + rownum/24/60 tm
      2             FROM   dual
      3             CONNECT BY ROWNUM <= (TO_DATE('&end_time','dd/mm/yyyy hh24:mi:ss')
      4                                   -TO_DATE('&start_time','dd/mm/yyyy hh24:mi:ss')
      5                                  )*24*60
      6            )
      7  SELECT tm
      8  FROM t;
    old   1: WITH t AS (SELECT TRUNC(TO_DATE('&start_time','dd/mm/yyyy hh24:mi:ss'),'MI') + rownum/24/60 tm
    new   1: WITH t AS (SELECT TRUNC(TO_DATE('08/10/2007 07:59:00','dd/mm/yyyy hh24:mi:ss'),'MI') + rownum/24/60 tm
    old   3:            CONNECT BY ROWNUM <= (TO_DATE('&end_time','dd/mm/yyyy hh24:mi:ss')
    new   3:            CONNECT BY ROWNUM <= (TO_DATE('08/10/2007 08:10:00','dd/mm/yyyy hh24:mi:ss')
    old   4:                                -TO_DATE('&start_time','dd/mm/yyyy hh24:mi:ss')
    new   4:                                -TO_DATE('08/10/2007 07:59:00','dd/mm/yyyy hh24:mi:ss')
    TM
    08/10/2007 08:00:00
    08/10/2007 08:01:00
    08/10/2007 08:02:00
    08/10/2007 08:03:00
    08/10/2007 08:04:00
    08/10/2007 08:05:00
    08/10/2007 08:06:00
    08/10/2007 08:07:00
    08/10/2007 08:08:00
    08/10/2007 08:09:00
    08/10/2007 08:10:00
    11 rows selected.Get stage, start & end times and duration
    SQL>SELECT ai1.stage
      2        ,ai1.time_stamp start_time
      3        ,ai2.time_stamp end_time
      4        ,SUBSTR(numtodsinterval(ai2.time_stamp-ai1.time_stamp, 'DAY'), 12, 8) duration
      5  FROM   dw2.incident ai1
      6  JOIN   dw2.incident ai2
      7         ON ai1.run_details_key = ai2.run_details_key
      8         AND ai1.stage = ai2.stage
      9  WHERE ai1.severity = 'START'
    10  AND ai2.severity = 'END'
    11  AND ai1.run_details_key  = 1
    12  ORDER BY ai1.time_stamp
    13  /
    STAGE      START_TIME          END_TIME            DURATION
    Stage1     08/10/2007 08:00:00 08/10/2007 08:08:53 00:08:52
    Stage2     08/10/2007 08:00:00 08/10/2007 08:04:23 00:04:22
    Stage3     08/10/2007 08:04:24 08/10/2007 08:10:00 00:05:36Then combine both (or do something else) to get this:
    TM                  THREAD_1 THREAD_2
    08/10/2007 08:00:00 Stage1   Stage2
    08/10/2007 08:01:00 Stage1   Stage2
    08/10/2007 08:02:00 Stage1   Stage2
    08/10/2007 08:03:00 Stage1   Stage2
    08/10/2007 08:04:00 Stage1   Stage2
    08/10/2007 08:05:00 Stage1   Stage3
    08/10/2007 08:06:00 Stage1   Stage3
    08/10/2007 08:07:00 Stage1   Stage3
    08/10/2007 08:08:00 Stage1   Stage3
    08/10/2007 08:09:00          Stage3
    08/10/2007 08:10:00          Stage3Ideally I'd like this to work for n-threads, as I want this to run on different environments that have different numbers of CPUs.
    Thank you for your time.

    > Ideally I'd like this to work for n-threads, as I want this to run on
    different environments that have different numbers of CPUs.
    The number of CPUs are not always a good indication of the processing load that a platform can take - especially when the processing load involves a lot of I/O.
    You can have 99% CPU idle time with a 1000 active processes... as that idle time is in fact CPU time spend waiting on I/O completion. Courtesy of a severely strained I/O channel that is the bottleneck.
    Another factor is memory (resources). You for example have 4 CPUs with 8GB physical memory.. where a single process (typically a Java VM for a complex process) grabs a huge amount of memory. Assuming that 4 threads/CPU or 1 threads/CPU can be a severe overestimate due to the amount of memory needed. Getting this wrong leads in turn to excessive virtual memory paging and reduces the platform's performance drastically.
    CPU alone is a very poor choice when deciding on the platform's capacity to run parallel processes.

Maybe you are looking for