Aggregate Function in Union All Reports

Hi All,
I am using a union report and in first report
1. Month/Year - Pending Count
2. Month/Year - Active Count
Now I want an average line graph(Total Active Count/Num of Months) for the active count.
Is it possible to generate it based on result columns ??
If I create reports using zeros for one of the calculation which are of the format
Jan 2010 - 10 - 0
Jan 2010 - 0 - 5
Both values don't get aggregated with line bar chart and it picks only one of them.
If I create reports using status as one of the column,
Jan 2010 - 'Pending' - 10
Jan 2010 - 'Active' - 5
This is OK for bars but where do I calculate average is the problem and 2 lines appear on the chart instead of one average line.
Is there any way to calculate average in this scenario ?
Appreciate any pointers.
Thanks
SM

Try the below querySELECT P1.projectID,p1.QuoteDate, Q1.QuoteCode,p1.*
FROM PROJECT P1 inner join (SELECT Q.ProjectID,Max(Q.QuoteDate) QD FROM QUOTE Q group by Q.ProjectID) Q1 on Q1.ProjectID = P1.ProjectID and Q1.QD=P1.QuoteDate-Prashanth

Similar Messages

  • Aggregate function usage in interactive reports

    Dear All,
    I am trying to use the aggregate option in interactive reports , i am not getting any outputs. Can any one please show any examples from your reports ? or give me some idea to get the functionality work done for my reports.
    Thanks in advance.
    Regards
    Dhanush.R

    Dear All,
    I am trying to use the aggregate option in interactive reports , i am not getting any outputs. Can any one please show any examples from your reports ? or give me some idea to get the functionality work done for my reports.
    Thanks in advance.
    Regards
    Dhanush.R

  • How to apply filters for union all report in OBIEE 11g

    Hi All
    Can we apply saved filters to union reports in obiee 11g?
    I am able to apply saved filters for normal reports but not for union reports.
    The catalog pane is blank, when i click on result columns or each criteria.
    The only option i see is to manually create the filters for each criteria, dont i have any choice to use a saved filter for union report?
    Is this a bug or something i am unaware. Please guide me
    Thanks

    Hi manu,
    Filter is created based on subject area.we can't use save filter in any other subject areas.
    now we can use new filter for union reports.
    if Helps please mark as correct.. :)

  • Selecting both a aggregate function and another field

    I am trying to do something very simple but I am not sure of the syntax.
    I would like to select all of the petid's and find the count of the pets in a given city, both from the same table, Pets.
    Can somebody please help me with this?
    Thanks

    Hi,
    An aggregate function will give you one row of output per group.
    For example, if you use the aggregate COUNT function to get the total number of rows in a whole table, then you can only have one row of output, representing the whole table, so, if I understand the problem, you can't (easily) use an aggregate function.
    Almost all of the aggregate functions have analytic counterparts, that can produce the same results without collapsing the result set into one row per group.
    I think this is what you requested:
    SELECT  petid
    ,       COUNT (*) OVER (PARTITION BY 1)  AS total_cnt
    FROM    pets
    WHERE   city    = 'Paris'  -- or whatever
    ;Sorry, I'm not at a database now, so I can't check, but I think you don't need the PARTITION BY clause, so you can also say:
    ,       COUNT (*) OVER ()  AS total_cntThe keyword OVER marks this as an analytic, rather than an aggregate, function.

  • Union All Function

    HI All,
    I am trying to make one query in wich i want territory wise sales report but i want to reflect it as territory 1 and its total than territory 2 and its total will union function will give me that result.
    So need help.
    Thanks-
    Mona

    Try:
    SELECT T2.descript,SUM(T0.DocTotal) 'Total Revenue',SUM(T0.GrosProfit) 'Gross Profit', 100*SUM(T0.DocTotal)/(SELECT SUM(DocTotal)
    FROM OINV) '% Total Revenue',100*SUM(T0.GrosProfit)/(SELECT SUM(GrosProfit)
    FROM OINV) '% Total Gross Profit'
    FROM OINV T0
    INNER JOIN OCRD T1 ON T1.CardCode=T0.CardCode
    INNER JOIN OTER T2 ON T2.territryID=T1.Territory
    GROUP BY T2.descript
    UNION ALL
    SELECT 'Total',SUM(T0.DocTotal) 'Total Revenue',SUM(T0.GrosProfit) 'Gross Profit', 100,100
    FROM OINV T0
    INNER JOIN OCRD T1 ON T1.CardCode=T0.CardCode
    INNER JOIN OTER T2 ON T2.territryID=T1.Territory

  • Inventory on Hand Report - Using Union ALL - need two fields to be part of the group

    Hi all,
    I have created an Inventory "on Hand" Report that takes the Current Inventory from the Item Entry table and the Sales from Unposted Sales Line table and Transfers in and out from the Unposted Transfer Line table.  I have joined the tables
    using the UNION ALL function. 
    My problem is that the Transfer table has two locations whereas the other tables only have one.  I am grouping on Location code from the Item Entry table which is equivalent to BOTH Transfer from location and the Transfer to.    
    As an example, there are 15lbs of inventory for Product A in Location #1 with a transfer out of 15 lbs.  The Transfer out is going to Location #2
    I don't know how to write the query or set up the group so that it recognizes both the Transfer to and the Transfer From fields
    I want the report to look similar to the one below but I can only get it to show one of the locations.  Is there some way to use the Union function and have one field in the first table be or equivalent to two fields in another?
    Location   Code
    Item No.
    Lbs
    Sales Orders
    Transfer Out
    Transfer In
    Available   Inventory
    Location #1
    Product A
    15
    -15
    Location #1
    15
    -15
    Location #2
    Product A
    15
    15
    Location #2
    15
    15

    Hi Igor,
    You can get a custom sort order added to your IP column without the need for a second column.
    Consider that the sorting is done strictly left-to-right across a string in the column. The string can be any valid HTML content. So, you could wrap your string within, say, a SPAN tag and add an attribute to that tag that contains the sort order you need before the text that is displayed to the user. As long as the attribute is correctly structured (that is, all instances are of the same length, for example), then sorting will work correctly. For example:
    SELECT
    '<span title="' || PAD_IP_ADDRESS(IP) || '">' || IP || '</span>' Y
    FROM ...Now you need to ensure that the PAD_IP_ADDRESS() function returns the correct values. In IP addresses, you have anything from "0.0.0.0" to "255.255.255.255". To get them to sort "numerically", you need to pad one or two digit numbers to get three digit numbers for each value - so, "0.0.0.0" becomes "000.000.000.000". You could create a function to do this - something like:
    CREATE OR REPLACE FUNCTION PAD_IP_ADDRESS
      pIP IN VARCHAR2
    RETURN VARCHAR2
    IS
      vIP VARCHAR2(15);
      vTEMP APEX_APPLICATION_GLOBAL.VC_ARR2;
      vSEP VARCHAR2(1);
    BEGIN
      vSEP := '';
      vIP := '';
      vTEMP := APEX_UTIL.STRING_TO_TABLE(pIP,'.');
      FOR x IN 1..vTEMP.COUNT
      LOOP
        vIP := vIP || vSEP || TRIM(TO_CHAR(TO_NUMBER(vTEMP(x)),'000'));
        vSEP := '.';
      END LOOP;
      RETURN vIP;
    END;The output from this would look something like:
    &lt;span title="001.001.001.001"&gt;1.1.1.1&lt;/span&gt;
    &lt;span title="002.255.255.255"&gt;2.255.255.255&lt;/span&gt;
    &lt;span title="010.001.199.098"&gt;10.1.199.098&lt;/span&gt;Andy

  • Aggregate function for a report that has sets

    My report combines similar analysis into sets. I need to apply aggregate function such as Max() to the resulting columns. I tried but Analytics doesn't like that. Can someone tell me if this is supported or not? If not, what would be a workaround?

    Have you tried placing the results into a pivot table then assigning this to display MAX results

  • Union All with Linked Servers - Works until loaded on to the report server then fails.

    Hi,
    On our production server I have 2 linked servers.  One that leads to ServiceNow via ODBC and one that leads to an HP Openview database.
    Testing these linked servers works fine.  I have a query that obtains info from each source and 'union all' together.  When i run this query in SQL Server management studio it works fine and I get info from both data sources union-ed together perfectly.
    I transfer this into Visual Studio and create a report, which again runs perfectly.
    I upload this report to the report server and try to run it and get the error: 
    An error has occurred during report processing. (rsProcessingAborted)
    Query execution failed for dataset 'Dataset1'. (rsErrorExecutingCommand)
    For more information about this error navigate to the report server on the local server machine, or enable remote errors
    When I rummage through the log files for the report server, I find very little helpful errors, basically this:
    ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: , Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: Query execution failed for dataset 'Dataset1'. ---> System.Data.SqlClient.SqlException: Cannot
    execute the query.
    I did a test where I created a copy of the report and ran only he Servicenow  section of the report and it works, then ran only the HP section of the report and it works.  It seems the UNION ALL is the problem somehow. 
    Anyone have any ideas??
    Thanks
    Kirsty

    Hi Kirsty,
    As you posted, this issue is caused by the security configuration of Linked Server.
    Generally, in a domain environment, we can specify a domain account as the stored credentials for the report, and then configure the Linked Server to "Be made using the login’s current security context".
    However,if we specify a SQL Server login as the stored credentials for the report, please set the Linked Server security to "By using this security context", and then providing the necessary credentials to authenticate at the linked server.
    Please also add the Reporting Services Security role to the Linked Server Remote Server Login Mappings.
    For more information about Creating Linked Servers, please refer to
    http://msdn.microsoft.com/en-us/library/ff772782.aspx
    About Security for Linked Servers, please refer to
    http://msdn.microsoft.com/en-us/library/ms175537.aspx
    Regards,
    Swallow

  • Report which concatenates 13 views with union all running slowly

    Oracle 8.1.7 windows 2000 server
    I am trying to improve the performance of a report which is comprised of 13 views.
    When I run each of the views individually, the total run time for the views is less than 5 minutes. When I run the report, it takes 28 minutes.
    Can anyone suggest why the extra time is being taken?
    To reiterate:
    select a,b from c; (executes in 10 seconds)
    select d, e from f (executes in 3 seconds)
    select x, y from z (executes in 1 minute)
    total runs time = 5 minutes
    However,
    select a,b from c
    union all
    select d, e from f
    union all
    select x, y from z (executes in 28 minutes)
    The execution plans do not change between the report and the indiividual views. Views are being concatenated with union all so no sorting is taking place
    Many thanks,
    Jason Parker.
    Edited by: jclparker on Feb 18, 2009 4:26 AM
    Edited by: jclparker on Feb 18, 2009 4:30 AM

    Could you post the execution plan? Please use formatting tags to save the white space while posting the plan.

  • Aggregate Function in a report region does not work.

    I have a Reports Region with a Region Source that contains an aggregate function. But when I run the page, the value of the function is not returned. I suspect it is a simple syntax error. can somebody tell me what is wrong with
    select "TAG_PERIOD_START_DATE", MIN("ORDER_NUMBER")
    from "#OWNER#"."TAG_ORDER"
    group by "TAG_PERIOD_START_DATE"
    order by "TAG_PERIOD_START_DATE"
    The problem is probably with the MIN("ORDER_NUMBER") part. I tried several versions of that, but none worked.
    The Grouping works fine -- the query returns the TAG_PERIOD_START_DATE, just not the value of the function.
    BTW, this query works in SQL Plus (with the quotes removed, of course).
    Thanks for any suggestion you may have.

    When I just made a change to the SQL, I got a message stating:
    You have requested to change the Interactive Report query. If you added columns to the query, they will not be displayed when the report is run. You will need to use the actions menu and either select the columns or click Reset. If you removed any columns from the query, it will disable existing filters, highlight rules, and other report settings referencing those columns. Please confirm your request.
    So maybe that was the cause of the problem yesterday. Where is the "Actions menu"?

  • Interactive Report with union all in the query

    I have an interactive report with the following query in the report region:
    select property,saddr1,upostdate,sotherdate1,journal_control-1000000000,account,sdesc,uref,
    suserdefined1,trans_notes,samount,detail_notes
    from journal_entries
    union all
    select property,saddr1,upostdate,sotherdate1,journal_control-700000000,account,sdesc,uref,
    suserdefined1,trans_notes,stotalamount,detail_notes
    from charge_entries;
    This gets translated as listed below during runtime. I am trying to pass a value to both SELECT statements instead of the just the bottom select statement. Is this possible using interactive reports.
    select
    PROPERTY,
    SADDR1,
    UPOSTDATE,
    SOTHERDATE1,
    ACCOUNT,
    SDESC,
    UREF,
    SUSERDEFINED1,
    TRANS_NOTES,
    SAMOUNT,
    DETAIL_NOTES,
    "JOURNAL_CONTROL-1000000000" "JOURNAL_CONTROL-1000000000"
    from (
    select property,saddr1,upostdate,sotherdate1,journal_control-1000000000,account,sdesc,uref,
    suserdefined1,trans_notes,samount,detail_notes
    from journal_entries
    union all
    select property,saddr1,upostdate,sotherdate1,journal_control-700000000,account,sdesc,uref,
    suserdefined1,trans_notes,stotalamount,detail_notes
    from charge_entries
    ) r
    where ("PROPERTY" = :APXWS_EXPR_1)
    0.14: IR binding: ":APXWS_EXPR_1"="APXWS_EXPR_1" value="prop1"
    Thanks for any help,
    Jim

    The bottom query is actually the third query, it encompasses the two that are unioned. It is generated by APEX to allow for the search facility - to achieve what you want ignore the larger query, and get your query working in something like SQL developer. Once it's working then put it into APEX, and the search wrapper will be generated.
    select property,saddr1,upostdate,sotherdate1,journal_control-1000000000,account,sdesc,uref,
    suserdefined1,trans_notes,samount,detail_notes
    from journal_entries
    where property = :YOUR_CRITERIA
    union all
    select property,saddr1,upostdate,sotherdate1,journal_control-700000000,account,sdesc,uref,
    suserdefined1,trans_notes,stotalamount,detail_notes
    from charge_entries
    where property = :YOUR_CRITERIA;
    Then you need to think about how you are using the report, if it is linked to from another report, then create a hidden variable and pass it from the parent.
    If the report is standalone , then you could create an item , that can be edited and when submitted, re-executes the report based on the criteria entered.
    Steve
    Hot and bothered in sunny Dubai

  • How do you identify all reports using a specific custom function?

    Is there a way to identify all Crystal reports that use a specific custom function?  When we make changes to the function we need to re-attach the function to the existing reports, but we need to know what and where they are.
    We are using CRS XI.
    Thanks.

    duplicate - please do not post multiple times

  • My mac won't wake up from a sleep and I have to unplug it to reboot as the power button doesn't function as well.  Any suggestions?  Running Lion 10.7.4 and sending all reports in.

    My mac won't wake up from a sleep and I have to unplug it to reboot as the power button doesn't function as well.  Any suggestions?  Running Lion 10.7.4 and sending all reports in to Apple.

    First things first:
    Update your profile (equipent, OSX, etc)
    In Lion MS office2004 is not compatible, are you stIll using it?
    Do the SMC RESET and do the PRAM reset.

  • Inconsistent SQL results when using View with UNION-ALL and table function

    Can any of you please execute the below scripts and check the output. In the table type variable, I am adding 4 distinct object ids, where as in the result, I get only the row pertaining to last id in the table type variable. Same row is returned 4 times (4= number of values in the table type).
    This scenario is occurring in our product with a SQL with exactly same pattern. I could simulate the same issue with the sample script I have provided.
    Database version: 11.2.0.3 Enterprise Edition, Single node
    Thank you.
    CREATE TABLE TEMP_T1 AS SELECT * FROM ALL_OBJECTS;
    CREATE TABLE TEMP_T2 AS SELECT * FROM ALL_OBJECTS;
    UPDATE TEMP_T2 SET OBJECT_ID = OBJECT_ID * 37;
    CREATE UNIQUE INDEX TEMP_T1_U1 ON TEMP_T1(OBJECT_ID);
    CREATE UNIQUE INDEX TEMP_T2_U1 ON TEMP_T2(OBJECT_ID);
    CREATE OR REPLACE VIEW TEMP_T1T2_V AS
    SELECT * FROM TEMP_T1 UNION ALL SELECT * FROM TEMP_T2;
    CREATE OR REPLACE TYPE TEMP_OBJ_TYPE AS OBJECT (OBJ_ID NUMBER);
    CREATE OR REPLACE TYPE TEMP_OBJ_TAB_TYPE IS TABLE OF TEMP_OBJ_TYPE;
    SET SERVEROUTPUT ON;
    DECLARE
    TYPE TEMP_T1T2_V_ROW_TAB_TYPE IS TABLE OF TEMP_T1T2_V%ROWTYPE;
    TEMP_T1T2_V_ROW_TAB TEMP_T1T2_V_ROW_TAB_TYPE;
    TEMP_OBJ_TAB TEMP_OBJ_TAB_TYPE := TEMP_OBJ_TAB_TYPE();
    PROCEDURE ADD_TO_TEMP_OBJ_TAB(OBJ_ID IN NUMBER) IS
    BEGIN
    TEMP_OBJ_TAB.EXTEND;
    TEMP_OBJ_TAB(TEMP_OBJ_TAB.LAST) := TEMP_OBJ_TYPE(OBJ_ID);
    END;
    BEGIN
    ADD_TO_TEMP_OBJ_TAB(100);
    ADD_TO_TEMP_OBJ_TAB(116);
    ADD_TO_TEMP_OBJ_TAB(279);
    ADD_TO_TEMP_OBJ_TAB(364);
    DBMS_OUTPUT.PUT_LINE('=====================');
    FOR I IN TEMP_OBJ_TAB.FIRST..TEMP_OBJ_TAB.LAST
    LOOP
    DBMS_OUTPUT.PUT_LINE('OBJ_ID = '||TEMP_OBJ_TAB(I).OBJ_ID);
    END LOOP;
    DBMS_OUTPUT.PUT_LINE('---------------------');
    SELECT * BULK COLLECT INTO TEMP_T1T2_V_ROW_TAB
    FROM TEMP_T1T2_V VW
    WHERE ((VW.OBJECT_ID) IN (SELECT OBJ_ID
    FROM TABLE(CAST(TEMP_OBJ_TAB AS TEMP_OBJ_TAB_TYPE))));
    FOR I IN TEMP_OBJ_TAB.FIRST..TEMP_OBJ_TAB.LAST
    LOOP
    DBMS_OUTPUT.PUT_LINE('OBJ_ID = '||TEMP_OBJ_TAB(I).OBJ_ID);
    END LOOP;
    DBMS_OUTPUT.PUT_LINE('---------------------');
    IF TEMP_T1T2_V_ROW_TAB.COUNT > 0 THEN
    FOR I IN TEMP_T1T2_V_ROW_TAB.FIRST..TEMP_T1T2_V_ROW_TAB.LAST
    LOOP
    DBMS_OUTPUT.PUT_LINE(TEMP_T1T2_V_ROW_TAB(I).OBJECT_ID||' : '||TEMP_T1T2_V_ROW_TAB(I).OBJECT_NAME);
    END LOOP;
    ELSE
    DBMS_OUTPUT.PUT_LINE('NO ROWS RETURNED!');
    END IF;
    DBMS_OUTPUT.PUT_LINE('---------------------');
    END;
    /

    I can reproduce it:
    SQL*Plus: Release 11.2.0.3.0 Production on Tue Oct 30 14:05:39 2012
    Copyright (c) 1982, 2011, Oracle.  All rights reserved.
    Enter user-name: scott
    Enter password:
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> select  *
      2    from  v$version
      3  /
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for 64-bit Windows: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    SQL> CREATE TABLE TEMP_T1 AS SELECT * FROM ALL_OBJECTS;
    Table created.
    SQL>
    SQL> CREATE TABLE TEMP_T2 AS SELECT * FROM ALL_OBJECTS;
    Table created.
    SQL>
    SQL> UPDATE TEMP_T2 SET OBJECT_ID = OBJECT_ID * 37;
    72883 rows updated.
    SQL>
    SQL> CREATE UNIQUE INDEX TEMP_T1_U1 ON TEMP_T1(OBJECT_ID);
    Index created.
    SQL>
    SQL> CREATE UNIQUE INDEX TEMP_T2_U1 ON TEMP_T2(OBJECT_ID);
    Index created.
    SQL>
    SQL> CREATE OR REPLACE VIEW TEMP_T1T2_V AS
      2  SELECT * FROM TEMP_T1 UNION ALL SELECT * FROM TEMP_T2;
    View created.
    SQL>
    SQL> CREATE OR REPLACE TYPE TEMP_OBJ_TYPE AS OBJECT (OBJ_ID NUMBER)
      2  /
    Type created.
    SQL> CREATE OR REPLACE TYPE TEMP_OBJ_TAB_TYPE IS TABLE OF TEMP_OBJ_TYPE
      2  /
    Type created.
    SQL> SET SERVEROUTPUT ON;
    SQL>
    SQL> DECLARE
      2  TYPE TEMP_T1T2_V_ROW_TAB_TYPE IS TABLE OF TEMP_T1T2_V%ROWTYPE;
      3  TEMP_T1T2_V_ROW_TAB TEMP_T1T2_V_ROW_TAB_TYPE;
      4  TEMP_OBJ_TAB TEMP_OBJ_TAB_TYPE := TEMP_OBJ_TAB_TYPE();
      5  PROCEDURE ADD_TO_TEMP_OBJ_TAB(OBJ_ID IN NUMBER) IS
      6  BEGIN
      7  TEMP_OBJ_TAB.EXTEND;
      8  TEMP_OBJ_TAB(TEMP_OBJ_TAB.LAST) := TEMP_OBJ_TYPE(OBJ_ID);
      9  END;
    10  BEGIN
    11  ADD_TO_TEMP_OBJ_TAB(100);
    12  ADD_TO_TEMP_OBJ_TAB(116);
    13  ADD_TO_TEMP_OBJ_TAB(279);
    14  ADD_TO_TEMP_OBJ_TAB(364);
    15  DBMS_OUTPUT.PUT_LINE('=====================');
    16  FOR I IN TEMP_OBJ_TAB.FIRST..TEMP_OBJ_TAB.LAST
    17  LOOP
    18  DBMS_OUTPUT.PUT_LINE('OBJ_ID = '||TEMP_OBJ_TAB(I).OBJ_ID);
    19  END LOOP;
    20  DBMS_OUTPUT.PUT_LINE('---------------------');
    21  SELECT * BULK COLLECT INTO TEMP_T1T2_V_ROW_TAB
    22  FROM TEMP_T1T2_V VW
    23  WHERE ((VW.OBJECT_ID) IN (SELECT OBJ_ID
    24  FROM TABLE(CAST(TEMP_OBJ_TAB AS TEMP_OBJ_TAB_TYPE))));
    25  FOR I IN TEMP_OBJ_TAB.FIRST..TEMP_OBJ_TAB.LAST
    26  LOOP
    27  DBMS_OUTPUT.PUT_LINE('OBJ_ID = '||TEMP_OBJ_TAB(I).OBJ_ID);
    28  END LOOP;
    29  DBMS_OUTPUT.PUT_LINE('---------------------');
    30  IF TEMP_T1T2_V_ROW_TAB.COUNT > 0 THEN
    31  FOR I IN TEMP_T1T2_V_ROW_TAB.FIRST..TEMP_T1T2_V_ROW_TAB.LAST
    32  LOOP
    33  DBMS_OUTPUT.PUT_LINE(TEMP_T1T2_V_ROW_TAB(I).OBJECT_ID||' : '||TEMP_T1T2_V_ROW_TAB(I).OBJECT_NAME);
    34  END LOOP;
    35  ELSE
    36  DBMS_OUTPUT.PUT_LINE('NO ROWS RETURNED!');
    37  END IF;
    38  DBMS_OUTPUT.PUT_LINE('---------------------');
    39  END;
    40  /
    =====================
    OBJ_ID = 100
    OBJ_ID = 116
    OBJ_ID = 279
    OBJ_ID = 364
    OBJ_ID = 100
    OBJ_ID = 116
    OBJ_ID = 279
    OBJ_ID = 364
    364 : I_AUDIT
    364 : I_AUDIT
    364 : I_AUDIT
    364 : I_AUDIT
    PL/SQL procedure successfully completed.
    SQL> column object_name format a30
    SQL> select  object_id,
      2          object_name
      3    from  dba_objects
      4    where object_id in (100,116,279,364)
      5  /
    OBJECT_ID OBJECT_NAME
           100 ORA$BASE
           116 DUAL
           279 MAP_OBJECT
           364 I_AUDIT
    SQL>  Works fine in:
    =====================
    OBJ_ID = 100
    OBJ_ID = 116
    OBJ_ID = 279
    OBJ_ID = 364
    OBJ_ID = 100
    OBJ_ID = 116
    OBJ_ID = 279
    OBJ_ID = 364
    100 : ORA$BASE
    116 : DUAL
    364 : SYSTEM_PRIVILEGE_MAP
    279 : MAP_OBJECT
    PL/SQL procedure successfully completed.
    SQL> select  object_id,
      2          object_name
      3    from  dba_objects
      4    where object_id in (100,116,279,364)
      5  /
    OBJECT_ID OBJECT_NAME
          100 ORA$BASE
          116 DUAL
          364 SYSTEM_PRIVILEGE_MAP
          279 MAP_OBJECT
    SQL> select  *
      2    from  v$version
      3  /
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL>SY.
    Edited by: Solomon Yakobson on Oct 30, 2012 2:14 PM

  • Union All is not bring the second part columns to the report

    I have 5 groups of series of Select statements and then I made a UNION ALL after the first group. Now it does run correctly and displays the output but it does not assign the second group' s field names.
    For example. I am greatly abridging
    Completed the SQL's needed to mimic a IBM i display screen. There are 5 product groups making up the screen. I was hoping to have one large Command SQL having the 5 SQLs using UNION ALL. This does 'compile' as a Command. However, it does only brings in the first part fields not the second. So this field is not included in the list of fields tree for COMMAND. PROGR2R2PST,
    Is there something not correct how doing the UNION ALL? OUTPUT assigns the column name
    of the first group to the second group. HLDGR1PUN 21454 87273
    so if i wanted to have one large SQL with union ALLs, it wont work. is there something other than UNION ALL I should use? One idea is if I can have 5 commands to my disposal. I guess  using subreports you can but it will be too slow.
    SELECT
    count(*) as PROGR1PST,
    SELECT COALESCE(SUM(OdQty#),0)
    FROM ASTCCDTA.OEORH48,ASTCCDTA.TRNSTAT2,ASTDTA.OEORD1
    WHERE OHCOM# = TSCOM# AND OHORD# = TSORD# AND OHCOM# = ODCOM# AND OHORD# = ODORD#
    AND TSSTAT IN('AEP','BGE')
    AND OHORDT IN('RTR','INT','SAM')
    AND OHREQD < replace(char(current date, iso), '-', '')
    AND OHHLDC = ' '
    AND ODPRLC = 'ENG'
    AND substr(odprt#,1,5) <> 'NOENG' AND OHORD# in(SELECT a.TSORD# FROM ASTCCDTA.TRNSTAT2 a
    WHERE a.tsstat IN('AEP','BGE','EAS','REL','STP'))
    ) AS PROGR1PUN,
    SELECT count(*)
    FROM ASTCCDTA.OEORH48,ASTCCDTA.TRNSTAT2,ASTCCDTA.OETRA99
    WHERE OHCOM# = TSCOM# AND OHORD# = TSORD#
    AND (otCOM# = OHCOM# AND OTORD#= OHORD# AND ottrnc = 'AQC')
    AND TSSTAT IN('AEP','BGE')
    AND OHORDT IN('RTR','INT','SAM')
    AND OHREQD = replace(char(current date, iso), '-', '')  AND OHHLDC = ' ' AND OHORD# in(SELECT a.TSORD# FROM ASTCCDTA.TRNSTAT2 a
    WHERE a.tsstat IN('AEP','BGE','EAS','REL','STP'))
    ) AS PROGR1TOD,
    etc..
    UNION ALL
    SELECT
    count(*) as PROGR2R2PST,
    (SELECT COALESCE(SUM(OdQty#),0) FROM ASTCCDTA.OEORH48,ASTCCDTA.TRNSTAT2,ASTDTA.OEORD1
      WHERE OHCOM# = TSCOM# AND OHORD# = TSORD# AND OHCOM# = ODCOM# AND OHORD# = ODORD#
      AND TSSTAT IN('AEP','BGE')
      AND OHORDT IN('CUS','CIN','SMC','COC','DON')
      AND OHREQD < replace(char(current date, iso), '-', '')
      AND OHHLDC = ' '
      AND ODPRLC = 'ENG'
      AND substr(odprt#,1,5) <> 'NOENG' AND OHORD# in(SELECT a.TSORD# FROM ASTCCDTA.TRNSTAT2 a 
    WHERE a.tsstat IN('AEP','BGE','EAS','REL','STP'))
    ) AS PROGR2PUN,

    hi Paul,
    a union combines record sets like this
    field1     field2
    1          2
    union
    field3     field4
    2          8
    will produce
    field1     field2
    1          2
    2          8
    note that there are no more field3 & field4 names. that's the way a union works.
    if you need separate fields for your other values then you would need to use sub-queries instead. to do that delete "UNION ALL " and create sub-queries with anything that is beneath that statement.

Maybe you are looking for

  • How to enter a BIOS/UEFI password in T420?

    Hello, I don't need to remove the UEFI supervisor password, I know what it is. The problem is that I can't get it to prompt me for that password! Pressing Thinkvantage button + F1 just prompts for the power-on password, and I'm never asked to enter t

  • Error 1 occurred when tried to install Flash Builder on Windows 8.  No files to uninstall.  Caught in loop

    I need to install Flash Builder 4.7 on my windows 8 computer.  I started the install process, but was soon stopped due to error 1.  The software wants me to uninstall/reinstall the software.  there is no program installed on the computer.  Cannot fin

  • R/3 ISA B2B:  Catalog Views

    Hello experts in the group, I need to create catalog views for R/3 ISA B2B application. I have to use cross division 00 to handle multiple sales areas and I want to address these divisions using catalog views. I already have one of the four product c

  • How is a file attachment stored in database?

    Hi all~~ I am developping an email application(web based) using Javamail. I need to store the attachment together with the relevant email messages in the database. Is that correct that I add an attribute called ATTACHMENT in the entity which stores t

  • LiveCache server time is 1hour behind SCM server

    is there a way to update the LiveCache server time, which is 1 hour behind our SCM server.  All I could find is that LC has a parameter called DATE_TIME_FORMAT but this is only a format, not an actual time zone type variable.  Also, STZAC does not wo