OBIEE not applying outer join syntax to filters

(Note: I've already thoroughly searched the forums before posting this. Thanks)
My problem is the following:
I'm trying to build a report that is a count from my fact table, grouped by month from my date dimension for a given year, resulting in 12 data points. The problem is that not all months have actual data, but I still need those months to show on the report with a count of zero. Typical simple reporting requirement.
I have already done the obvious and within my business layer made the join between my fact table and my date dimension an outer join on the fact side, just like you'd do if writing the query by hand. And when tested by hand this includes all dates for the year anyway, and when coupled with the appropriate null test on the count measure I'd get my 12 data points with zeros were appropriate.
The problem is that there are additional filters I need to apply on the fact data (there are a couple text-based code values that didn't warrant full tables themselves so are just degenerate dimensions directly on the fact table.)
When these filters are applied at the Answer level, I'm only getting back the months that actually have data, and lose the months where the count should be zero. A check of the session log for the query that was generated shows the problem. While OBI properly generates the outer-join syntax for the join itself between the two tables (my date dim and fact table) it does NOT apply the outer-syntax to the constant-based filter against the fact, effectively negating the outer join.
Actual query from the log (I simply changed the table aliases from the ugly T##### stuff OBI generates to something more readable for posting here):
select D.DT_MONTH_NAME as c1,
D.DT_MONTH_NUM as c2,
I.INC_TYPE as c3,
I.INC_EMP_GROUP as c4,
sum(case when I.INC_KEY is null then 0 else 1 end ) as c5
from DATE_DIM D, INCIDENT_F I
where ( D.DATE_KEY = I.DATE_KEY (+) ) and ( D.DT_YEAR = 2010 and I.INC_EMP_GROUP = 'CONTRACTOR' )
group by D.DT_MONTH_NUM, D.DT_MONTH_NAME, I.INC_TYPE, I.INC_EMP_GROUP
order by c2
You can see that the outer syntax (+) is applied to the join, but not to the filter on I.INC_EMP_GROUP. If I take this query and drop it in something like SQL Developer, it only returns the months with data. If I throw the (+) after I.INC_EMP_GROUP like I'd do if writing this by hand, the desired zero-months results pop back in.
I have already searched the forums and while lots of people seem to have asked this question, the only solutions involve things like trickery in the business layer using dummy fact tables followed by manipulations at the report level etc. Unfortunately I can't rely on these as the system is eventually to be turned over to users who can't be expected to apply various hacks to write reports.
Anyone ever get to the bottom of getting OBI to apply outer join logic in filters as well, when the filtered table is meant to be outer-joined to?
Any comments are appreciated.
John

I know that this thread is a bit old thought it might be helpful to some one...
The Issue is, when using Degener@teDimen$ion ( this is !nner joned to FACT tables in BMM) and if any of the dimensions {other than theDegener@teDimen$ion (Let us say Dim X) } have an ()uter join to any of the fact tables, and you were doing your analysis using Degener@teDimen$ion,  Dim X, Measure value you will face the following issues.
when filtering the analysis on the ()uter join dimension ( Dim X), the IN filter will not work. Reason is that the filter is getting applied to both the Dimension and FACT tables and the values that exist in Dimension Dim X but not in FACT table wont show up.
     The above issue can be fixed by changing the join between the fact and Degener@teDimen$ion from inner to outer. I think this is a bug.. because  it is supposed to filter the fact  table after the entire outer joined result is obtained but not filter the fact table for the Dim X values and do a outer join. I think the BI should be intelligent enough.

Similar Messages

  • Outer Join Syntax in sql2k to Oracle Migration

    All of my existing SQL Server 2000 code is using the (INNER, LEFT OUTER, RIGHT OUTER) JOIN syntax which according to Oracle SQL Reference (A90125-01) is supported. The migration workbench seems to want to convert this to the old style syntax of putting (+) in the where clause conditions. I am therefore getting lots of warnings telling me that "complex outer joins are not reliably supported". Is there a setting somewhere that will tell the migration workbench to maintain (subject to required conversion) the original syntax format.

    Hi Doug,
    The issue you report has been tackled in a recent internal build released by the OMWB team. OMWB version 9.2.0.1.6 which is freely downloadable on the http:\\mtg.ie.oracle.com site. As I've mentioned, this is an internal release and is therefore not supported - although it is very stable and has already been used by several internal customers. We expect to have a fully supported release of OMWB available on OTN in December.
    In version 9.2.0.1.6, there is an option in the "Parse Options" tab on the Stored Procedures property sheet called "Generate Oracle 8i Outer Joins" - this setting is switched off by default in this build and would therefore preserve your ANSI compliant joins by default. Switching the setting on causes the OMWB parser to generate the joins in the old (+) Oracle syntax standard.
    I hope this helps,
    Tom.

  • "use ODBC outer join syntax on limits"  issues

    I'm converting a series of BQY's from Brio 6.6 to Hyperion 9.3. I have some questions about the "use ODBC outer join syntax on limits" option in the OCE. I sort of understand this option's purpose, but I don't completely understand the SQL I'm seeing. For example Brio 6.6 is generating the following SQL statement:
    SELECT * FROM tblA AL1 LEFT OUTER JOIN tblB AL38 ON (AL38.ParentID=AL1.ChildID AND
    AL38.Data='SomeData') WHERE ((NOT AL38.Action IS NULL))
    Now, Hyperion 9.3 generated the SQL statement as follows:
    SELECT * FROM tblA AL1 LEFT OUTER JOIN tblB AL38 ON (AL38.ParentID=AL1.ChildID AND
    AL38.Data='SomeData') AND (NOT AL38.Response IS NULL))
    My questions are:
    1) Why isn't the "NOT AL38.Action IS NULL" statement included in the outer join in Brio? I'm OK with the fact that it is not, but my limited understanding of the "use ODBC outer join syntax on limits" seems to indicate that it should end up there.
    2) The Hyperion SQL is returning incorrect results. How can I get Hyperion to generate the same SQL as Brio? And still use the OCE with "use ODBC outer join syntax on limits" selected? This setting is working fine for other BQY's.

    In the first post, I modified the actual table name I'm using, the following is my actual output:
    SQL> SELECT A0.name partName,A2.name usedPartName FROM WTPartUsageLink A1
    2 RIGHT OUTER JOIN (
    3 (SELECT A0.idA2A2,A0B.name FROM WTPart A0 INNER JOIN WTPartMaster A0B
    4 ON ((A0.idA3masterReference = A0B.idA2A2)))
    5 UNION ALL
    6 (SELECT A0.idA2A2,A0B.name
    7 FROM WTProduct A0 INNER JOIN WTProductMaster A0B ON ((A0.idA3masterRefer
    ence = A0B.idA2A2)))) A0
    8 ON (A0.idA2A2 = A1.idA3A5) LEFT OUTER JOIN
    9 (SELECT A2.idA2A2,A2.name FROM WTPartMaster A2
    10 UNION ALL
    11 SELECT A2.idA2A2,A2.name FROM WTProductMaster A2) A2
    12 ON (A1.idA3B5 = A2.idA2A2) ORDER BY partName DESC,usedPartName DESC;
    FROM WTProduct A0 INNER JOIN WTProductMaster A0B ON ((A0.idA3masterRefer
    ence = A0B.idA2A2)))) A0
    ERROR at line 7:
    ORA-00923: FROM keyword not found where expected
    SQL> select * from v$version;
    BANNER
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production
    PL/SQL Release 9.2.0.1.0 - Production
    CORE 9.2.0.1.0 Production
    TNS for Solaris: Version 9.2.0.1.0 - Production
    NLSRTL Version 9.2.0.1.0 - Production
    Thanks,

  • Old outer join syntax produces different results from new syntax!

    I have inherited a query that uses the old outer join syntax but that is yielding correct results. When I translate it to the new outer join syntax, I get the results I expect, but they are not correct! And I don't understand why the old syntax produces the results it produces. Bottom line: I want the results I'm getting from the old syntax, but I need it in the new syntax (I'm putting it into Reporting Services, and RS automatically converts old syntax to new).
    Here's the query with the old outer join syntax that is working correctly:
    Code Snippet
    SELECT   TE = COUNT(DISTINCT T1.ID),
             UE = COUNT(DISTINCT T2.ID),
             PE = CONVERT(MONEY, COUNT(DISTINCT T2.ID)) / 
                  CONVERT(MONEY,COUNT(DISTINCT T1.ID))
    FROM     TABLE T1, TABLE T2
    WHERE    T1 *= T2
    In this query, much to my surprise, TE <> UE and PE <> 1. However, TE, UE, and PE seem to be accurate!
    Here's the query with the new outer join syntax that is working but not producing the results I need:
    Code Snippet
    SELECT   TE = COUNT(DISTINCT T1.ID),
             UE = COUNT(DISTINCT T2.ID),
             PE = CONVERT(MONEY, COUNT(DISTINCT T2.ID)) / 
                  CONVERT(MONEY,COUNT(DISTINCT T1.ID))
    FROM     TABLE T1 LEFT OUTER JOIN TABLE T2 ON T1.ID = T2.ID
    Though not producing the results I need, it is producing what would be expected: TE = UE and PE = 1.
    My questions:
    1) Can someone who is familiar enough with the old syntax please help me understand why TE <> UE and PE <> 1 in the first query?
    2) Can someone please tell me how to properly translate the first query to the new syntax so that it continues to produce the results in the first query?
    Thank you very much.

    How can we reproduce the issue?
    Code Snippet
    USE [master]
    GO
    EXEC sp_dbcmptlevel Northwind, 80
    GO
    USE [Northwind]
    GO
    SELECT
    TE
    = COUNT(DISTINCT T1.OrderID),
    UE = COUNT(DISTINCT T2.OrderID),
    PE = CONVERT(MONEY, COUNT(DISTINCT T2.OrderID)) /
    CONVERT(MONEY,COUNT(DISTINCT T1.OrderID))
    FROM
    dbo
    .Orders T1, dbo.Orders T2
    WHERE
    T1
    .OrderID *= T2.OrderID
    SELECT
    TE
    = COUNT(DISTINCT T1.OrderID),
    UE = COUNT(DISTINCT T2.OrderID),
    PE = CONVERT(MONEY, COUNT(DISTINCT T2.OrderID)) /
    CONVERT(MONEY,COUNT(DISTINCT T1.OrderID))
    FROM
    dbo
    .Orders T1
    LEFT OUTER JOIN
    dbo.Orders T2
    ON T1.OrderID = T2.OrderID
    GO
    EXEC sp_dbcmptlevel Northwind, 90
    GO
    Result:
    TE
    UE
    PE
    830
    830
    1.00
    TE
    UE
    PE
    830
    830
    1.00
    As you can see, I am getting same results.
    AMB

  • ORA-01799: a column may not be outer-joined to a subquery

    Hi,
    How to solve this problem below?
         and id2.invoice_line_id*(+)*=(select min(invoice_line_id)
              from TW.invoice_detail
              where invoice_id=239917
              and (bl_amount_currency='USD' AND actual_amount_currency='VND'
              OR bl_amount_currency='VND' AND actual_amount_currency='USD')
    ERROR at line 150:
    ORA-01799: a column may not be outer-joined to a subquery
    Since there's an uncertain existence in id2, it needs to be outer-joined to that!
    Bst Rgds,
    HuaMin

    You cant do a outer join on a sub query. Can you describe what are you trying to do?

  • SQL Server "LEFT OUTER JOIN" syntax

    Haven't seen a solution to this on the forum or in the docs.
    I've got 2 objects, Task and Role, that are linked in a M-M relationship.
    My tables are:
    T_TASKS
    T_TASKSROLES
    T_ROLES
    I am querying T_TASKS and joining on T_ROLES, but I need to use an outer join on T_ROLES.
    In SQL Server, my FROM clause SHOULD look like this:
    FROM (T_TASKSROLES t2 LEFT OUTER JOIN T_TASKS t1 ON t1.ID = t2.TASKID) LEFT OUTER JOIN T_ROLES t0 ON t0.ID = t2.ROLEID
    however, if I use eb.anyOfAllowingNone(_roles) in my ExpressionBuilder. TopLink creates a LEFT OUTER JOIN clause that looks like this:
    FROM T_ROLES t0 LEFT OUTER JOIN T_TASKS t1 ON ((t0.ID = T_TASKSROLES.ROLEID) AND (t1.ID = T_TASKSROLES.TASKID))
    I can see the logic in how it builds this clause. But, it doesn't parse in SQL Server.
    Is there a way to effect how TopLink generates the FROM clause for outer joins? I mean, I understand how to use the XXXPlatform.java source files and can change whether to use OuterJoin in the WHERE clause or not. But, I can't see anything in the platform class that would allow me to figure this out.
    I realize I could write SQL manually, but is there a way to do this so that the same code would work on SQL Server, Oracle, and Sybase (assuming the DatabaseLogin is configured appropriately)?
    It just seems like LEFT OUTER JOIN when joining M-M relationships isn't generating proper SQL. Is the TopLink SQL SQL92-compliant?
    Nate

    I should add that I have tried to change SQLServerPlatform to have shouldPrintOuterJoinInWhereClause() return "true". This embeds a "=*" in the join conditions in the WHERE clause.
    SQL Server 2000 still supports this syntax, but the "=*" isn't ALWAYS the correct operator. It is IMPORTANT to put the "*" on the correct side of the expression.
    TopLink always prints "=*", and it always puts it in the correct space, but the OPERATORS are not always in the correct order so you are creating a "left join" on the wrong table.
    So my other question, is it possible to FORCE TopLink to remember to put the outer join table in the RIGHT SIDE?
    Nate

  • SQL 92 Outer Join Syntax and Funtion.

    When i am trying to use {fn substring(..)} or {oj table} in sql query to make it database independent, oralce driver does not support this.
    Could any one explain the above issue?
    If so, How do i use it? Explain the syntax a bit.
    Thanks in Advance,
    Ramani.

    I should add that I have tried to change SQLServerPlatform to have shouldPrintOuterJoinInWhereClause() return "true". This embeds a "=*" in the join conditions in the WHERE clause.
    SQL Server 2000 still supports this syntax, but the "=*" isn't ALWAYS the correct operator. It is IMPORTANT to put the "*" on the correct side of the expression.
    TopLink always prints "=*", and it always puts it in the correct space, but the OPERATORS are not always in the correct order so you are creating a "left join" on the wrong table.
    So my other question, is it possible to FORCE TopLink to remember to put the outer join table in the RIGHT SIDE?
    Nate

  • Change Outer Join Syntax

    Post Author: jasonp1980
    CA Forum: Data Connectivity and SQL
    I am currently using a ODBC driver provided by Esker to link into an IBM Informix Database 4.2When compiling a link in Crystal the SQL for this comes out as shown bellow with a syntax error. FROM   table1 LEFT OUTER JOIN table2But if I amend this to as bellow it works  FROM   table1, OUTER table2How can I change the term used in Crystal XI (11) for outer joins, I found some documentation on how to do this for version 7 (link bellow) but not for XI, thanks for any help. http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do;jsessionid=0762FD2EDFF69A9AD85E7FB81E7E6573?cmd=displayKC&docType=kc&externalId=c2003023&sliceId=&dialogID=360384&stateId=1%200%20356275  

    Post Author: V361
    CA Forum: Data Connectivity and SQL
    Jason, Save out a copy of the report, and then open it,  if you use a command, you should be able to put your own SQL in.  Database, set datasource, create new connection, select your data source,  select add command.
    Your SQL statement will go in the command.

  • Oracle 8i Full Outer Join Syntax

    Can someone please help me run this on Oracle 8i:
    SELECT
    R.CUSTOMER_NUM,
    R.SURNAME_NM,
    R.FIRST_NM,
    R.STREET_NM,
    R.PROV_CD,
    R.CITY_NM,
    R.POSTL_CD,
    W.ADDR_TWO_DESC,
    C.RTL_CO_NUM,
    C.CARD_NUM
    FROM
    RTL_CUST R
    FULL OUTER JOIN WHLSL_CUST W ON (R.CUST_NUM = W.CUST_NUM)
    FULL OUTER JOIN CUSTOMER_CARD C ON (T.CUST_NUM = C.CUST_NUM)
    I only know the ANSI syntax. Whats the old one?

    Is this correct:
    SELECT R.CUST_NUM, R.SURNAME_NM, R.FIRST_NM, R.STREET_NM, R.PROV_CD, R.CITY_NM, R.POSTL_CD, W.ADDR_TWO_DESC, NULL AS RTL_CO_NUM, NULL AS CARD_NUM
    FROM CCD_RTL_CUST R, CCD_WHLSL_CUST W WHERE R.CUST_NUM (+) = W.CUST_NUM
    UNION
    SELECT R.CUST_NUM, R.SURNAME_NM, R.FIRST_NM, R.STREET_NM, R.PROV_CD, R.CITY_NM, R.POSTL_CD, W.ADDR_TWO_DESC, NULL AS RTL_CO_NUM, NULL AS CARD_NUM
    FROM CCD_RTL_CUST R, CCD_WHLSL_CUST W WHERE R.CUST_NUM = W.CUST_NUM (+)
    UNION
    SELECT R.CUST_NUM, R.SURNAME_NM, R.FIRST_NM, R.STREET_NM, R.PROV_CD, R.CITY_NM, R.POSTL_CD, NULL AS ADDR_TWO_DESC, C.RTL_CO_NUM, C.CARD_NUM
    FROM CCD_RTL_CUST R, CUST_CARD C WHERE R.CUST_NUM (+) = C.CUST_NUM
    UNION
    SELECT R.CUST_NUM, R.SURNAME_NM, R.FIRST_NM, R.STREET_NM, R.PROV_CD, R.CITY_NM, R.POSTL_CD, NULL AS , C.RTL_CO_NUM, C.CARD_NUM
    FROM CCD_RTL_CUST R, CUST_CARD C WHERE R.CUST_NUM = C.CUST_NUM (+);

  • Outer join syntax - oracle 8i

    Here is an Oracle 8i issue I've run into ....
    I am trying to create a table that contains a record for each hour of the day (even if count is 0). I have a problem when I try a right outer join using the following syntax:
    SELECT MDT.date_field, COUNT(*)
    FROM MASTER_DATE_TABLE MDT, hsa_tgt.PICIS_OR POR
    WHERE MDT.date_field = TO_CHAR(POR.OR_IN_DTTM,'YYYYMMDDHH24') (+)
    AND TO_DATE(MDT.date_field,'YYYYMMDDHH24') >= '01-Jan-2006'
    AND TO_DATE(MDT.date_field,'YYYYMMDDHH24') <= '31-Jan-2006'
    GROUP BY MDT.date_field;
    The problem 'SQL code no properly ended' only occurs if I use the TO_CHAR function (or any function for that matter) on the outer join line.
    Is there a workaround? I did manage to create a temporary table and then successfully do an outer join in order to bypass having the to_char function in the join statement.
    Maybe a union?
    TIA

    I had to put it in a subquery? (if that's what it's called)
    SELECT a1.date_field DateAndHour, b1.OR_date, NVL(b1.record_count,0)
    FROM  MASTER_DATE_TABLE a1,
                  (SELECT TO_CHAR(b.OR_IN_DTTM,'YYYYMMDDHH24') OR_date, COUNT(*) record_count
                FROM hsa_tgt.PICIS_OR b
                GROUP BY TO_CHAR(b.OR_IN_DTTM,'YYYYMMDDHH24')) b1
    WHERE a1.date_field  = b1.OR_date (+)
    GROUP BY a1.date_field, b1.OR_date, b1.record_count
    HAVING (TO_DATE(a1.date_field,'YYYYMMDDHH24') BETWEEN '01-Jan-2006' AND '31-Jan-2006')
    ORDER BY a1.date_field;

  • Outer Join Syntax

    I have an SQL statement with an outer join which works just fine, but when I go and add an "UPPER" function to one of the where statements, I get and error message indicating that my Command is not properly ended (Oracle 8I). Why?
    Select ECD_ID, to_char(DATE_OF_SUBMISSION, 'MM/DD/YYYY') as Date_Of_Submission
    from ECD_Project_State_Log, code_tbl a, code_tbl b, users u
    where ECD_ID = 1
    and UPPER(CURR_PROJECT_STATE) = UPPER(a.code_Name) (+)
    and REQ_PROJECT_STATE = b.code_Name (+)
    and REVIEWED_BY = u.User_id (+)
    order by Date_Of_Submission;

    Try this:
    and UPPER(CURR_PROJECT_STATE) = UPPER(a.code_Name(+))
    SQL> select e.ename, d.loc from emp e, dept d where d.deptno = upper(e.deptno)(+) ;
    select e.ename, d.loc from emp e, dept d where d.deptno = upper(e.deptno)(+)
    ERROR at line 1:
    ORA-00936: missing expression
    SQL> select e.ename, d.loc from emp e, dept d where d.deptno = upper(e.deptno(+)) ;
    ENAME      LOC
    CLARK      NEW YORK
    KING       NEW YORK
    MILLER     NEW YORK
    SMITH      DALLAS
    ADAMS      DALLAS
    FORD       DALLAS
    SCOTT      DALLAS
    JONES      DALLAS
    ALLEN      CHICAGO
    BLAKE      CHICAGO
    MARTIN     CHICAGO
    JAMES      CHICAGO
    TURNER     CHICAGO
    WARD       CHICAGO
               BOSTON
    15 rows selected.
    SQL> disconnect
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.3.0 - Production
    SQL>

  • Outer join style report - OBIEE 10g

    Hi All,
    I have a requirement to generate a report for product & sales. I have two dimensions and various fact data elements.
    Some products may not be sold on a month but still i want to display them in the report with 0 value. I have tried this by creating a Left outer join in RPD, since we are using some other dimension in the fact calculation (calculated column) so that also comes in to the left outer join group and that mess with the results.
    So am looking for the better approach to bring the results through answers. Here is the data and expected results
    Data
    Product | Month | Sale | Margin
    Fridge | May | 100 | 20%
    Coolers| May | 50 | 4%
    Laptop| Jun| 300 | 15%
    Now am filtering the report for the month of May, my results should be looks like
    Product | Sale | Margin
    Fridge | 100 | 20%
    Coolers|50 | 4%
    Laptop| 0 | 0%
    Can anyone provide a solution for this ?
    Thanks,
    Ugser

    One possible solution is based on the fact, that OBIEE is combining (=outer joining) measures from two different fact tables by their commonly shared dimensions. What you have to do is:
    Physical layer:
    - create a new dummy fact table in the physical layer (e.g. using a view like Select 1 from dual;)
    - join all required dimension tables to the dummiy fact table using a complex foreign key. Make sure it evaluates always to true, e.g. 1=1.
    BMM:
    - create a new logical fact table for the dummy fact and join all required logical dimension tables to it using complex joins. Set the levels in content tab of LTS same way as for your other fact.
    Presentation layer:
    - expose the dummy fact column
    Answers:
    - Drag the dummy fact into your report. You might want to hide it because for a normal user it is confusing and meaningless since it will always show 1.
    - Filtering should work fine now.
    The dummy fact column will cause OBIEE to create a cartesian join, i.e. all combinations of dimension attributes used in the report will be created. Then the result of the second fact (in your case sales) will be added. In your example it will create a record for each Month for each Product. Sales and Margin will be only added for those Month and Product combinations where there are data in the sales fact.
    Hope this helps.
    Cheers,
    Peter

  • ANSI SQL 92 SYNTAX OUTER JOIN PERFORMANCE ISSUE

    Good Morning
    Could anyone explain why the excution time for these two (ment to be identical)
    queries run so differently.
    oracle syntax execution time 1.06 seconds
    select COUNT(*) from
    PL_EVENT_VIEW pev,
    PL_EVENT_STAFF_VIEW pesv
    WHERE pev.EVENT_ID=PESV.EVENT_ID(+)
    AND pev.WEEKS=PESV.WEEK_NUM(+)
    AND pev.event_id=2520
    ansi sql 92 syntax execution time 7.05 seconds
    select COUNT(*) from
    PL_EVENT_VIEW pev
    LEFT JOIN PL_EVENT_STAFF_VIEW pesv
    ON (pev.EVENT_ID=PESV.EVENT_ID
    AND pev.WEEKS=PESV.WEEK_NUM)
    WHERE pev.event_id=2520
    Thanks
    David Hills

    BTW Oracle outer join operator (+) and ANSI SQL OUTER JOIN syntax are NOT equivalent. Consider following:
    DROP TABLE T1;
    CREATE TABLE T1 (C1 NUMBER);
    DROP TABLE T2;
    CREATE TABLE T2 (C2 NUMBER);
    DROP TABLE T3;
    CREATE TABLE T3 (C3 NUMBER);
    -- Following SELECT works:
    SELECT COUNT(*)
         FROM T1, T2, T3
         WHERE C2 = C1
              AND C3(+) = C1
    COUNT(*)
    0
    -- But:
    SELECT COUNT(*)
         FROM T1, T2, T3
         WHERE C2 = C1
              AND C3(+) = C1
              AND C3(+) = C2
    AND C3(+) = C1
    ERROR at line 4:
    ORA-01417: a table may be outer joined to at most one other table
    -- However with ANSI syntax:
    SELECT COUNT(*)
         FROM T1
         JOIN T2 ON (C2 = C1)
         LEFT JOIN T3 ON (C3 = C1 AND C3 = C2)
    COUNT(*)
    0

  • While using the Old syntax of outer join i encountered Ora-01719 error .

    This is quite strange when i used the Old way of using Outer Joins(+), i encountered the Ora-01719 error saying Outer Joins not allowed in Or and IN operator.Whereas when i use the ANSI sql i query gets executed without any error.Any idea what might be the reason..is it that i myself is making mistake.
    Please find the select statement below..
    SELECT d4.c2, d4.c8, vw_rpt_prod_ln_grp.prod_grp_desc, d4.c10, d4.c5, d4.c3,
    CASE
    WHEN d4.c6 = 'Closed'
    THEN d4.c6
    WHEN d4.c6 = 'Closed (w/o Action)'
    THEN d4.c6
    WHEN d4.c6 =
    'Closed, Supporting Process(es) Active'
    THEN d4.c6
    WHEN d4.c6 = 'Cancelled'
    THEN d4.c6
    WHEN t3.workflow_compnt_id = 1
    THEN 'Definition'
    WHEN t3.workflow_compnt_id = 2
    THEN 'Root Cause'
    WHEN t3.workflow_compnt_id = 3
    THEN 'Solution'
    WHEN t3.workflow_compnt_id = 4
    THEN 'Implementation'
    WHEN t3.workflow_compnt_id = 5
    THEN 'Feedback'
    WHEN t3.workflow_compnt_id = 9
    THEN 'Preliminary Root Cause'
    WHEN t3.workflow_compnt_id = 2001
    THEN 'Report'
    WHEN t3.workflow_compnt_id = 2002
    THEN 'Sent'
    WHEN t3.workflow_compnt_id = 2003
    THEN 'Add. Info Needed'
    WHEN t3.workflow_compnt_id = 2004
    THEN 'Open'
    WHEN t3.workflow_compnt_id = 2007
    THEN 'Solution Feedback'
    END issue_workflow_status,
    CASE
    WHEN d4.c6 = 'Closed'
    THEN 0
    WHEN d4.c6 = 'Closed (w/o Action)'
    THEN 0
    WHEN d4.c6 =
    'Closed, Supporting Process(es) Active'
    THEN 0
    WHEN d4.c6 = 'Cancelled'
    THEN 0
    ELSE t3.workflow_compnt_id
    END issue_workflow_status_code,
    d4.c6, d4.c9,
    CASE t3.issue_step_status_cd
    WHEN 'In Progress'
    THEN t3.step_target_submit_dt
    WHEN 'Needs Additional Information'
    THEN t3.step_target_submit_dt
    WHEN 'Awaiting Approval'
    THEN t3.step_target_closed_dt
    ELSE NULL
    END target_date,
    CASE
    WHEN CASE t3.issue_step_status_cd
    WHEN 'In Progress'
    THEN t3.step_target_submit_dt
    WHEN 'Needs Additional Information'
    THEN t3.step_target_submit_dt
    WHEN 'Awaiting Approval'
    THEN t3.step_target_closed_dt
    ELSE NULL
    END IS NULL
    THEN 'N'
    WHEN CASE t3.issue_step_status_cd
    WHEN 'In Progress'
    THEN t3.step_target_submit_dt
    WHEN 'Needs Additional Information'
    THEN t3.step_target_submit_dt
    WHEN 'Awaiting Approval'
    THEN t3.step_target_closed_dt
    ELSE NULL
    END < TRUNC (CURRENT_DATE)
    THEN 'Y'
    ELSE 'N'
    END step_is_late,
    t3.orig_user_full_nm, t3.champ_user_full_nm, t3.champ_org_nm,
    vw_rpt_defntn.modl_yr_nbr, vw_rpt_vpps_lvl.level1_vpps_desc,
    vw_rpt_vpps_lvl.level2_vpps_desc, vw_rpt_vpps_lvl.level3_vpps_desc,
    vw_rpt_vpps_lvl.level4_vpps_desc,
    Mv_RPT_CONCAT_ENGN_OPTN_ALL.concat_engn_optn,
    vw_rpt_incdnt_src_three_level.level1_incdnt_src_desc,
    vw_rpt_incdnt_src_three_level.level2_incdnt_src_desc,
    vw_rpt_incdnt_src_three_level.level3_incdnt_src_desc,
    vw_rpt_warranty_labr_code.concat_warranty_labr_code_desc, d4.c4, d4.c7,
    vw_cust_survey_type.cust_survey_type_desc,
    vw_complaint_ctg.complaint_ctg_cd,
    vw_prob_main_cause.prob_main_cause_desc, soltn_step.confidence_lvl_id,
    d4.c12, d4.c13
    FROM (SELECT DISTINCT vw_rpt_issue.project_id c0,
    vw_rpt_issue.prts_prod_ln_id c1,
    vw_rpt_issue.issue_id c2,
    vw_rpt_issue.disply_issue_nbr c3,
    vw_rpt_issue.issue_sevrty_cd c4,
    vw_rpt_issue.proj_nbr c5,
    vw_rpt_issue.issue_status_cd c6,
    vw_rpt_issue.primry_metric_score_nbr c7,
    vw_rpt_issue.issue_type_cd c8, vw_rpt_issue.title c9,
    vw_rpt_issue.prts_prod_ln_desc c10,
    vw_rpt_leadtime.issue_id c11,
    vw_rpt_leadtime.definition_start_dt c12,
    vw_rpt_leadtime.definition_close_dt c13,
    vw_rpt_leadtime.root_cause_start_dt c14,
    vw_rpt_leadtime.root_cause_close_dt c15,
    vw_rpt_leadtime.solution_start_dt c16,
    vw_rpt_leadtime.solution_end_dt c17,
    vw_rpt_leadtime.implementation_start_dt c18,
    vw_rpt_leadtime.implementation_close_dt c19,
    vw_rpt_leadtime.feedback_start_dt c20,
    vw_rpt_leadtime.feedback_end_dt c21,
    vw_rpt_leadtime.prc_start_dt c22,
    vw_rpt_leadtime.prc_end_dt c23,
    defntn_step.issue_id c24,
    defntn_step.workflow_compnt_id c25,
    defntn_step.complaint_ctg_id c26,
    defntn_step.contnmt_actn_plan_id c27,
    defntn_step.direct_run_imprvm_pct c28,
    defntn_step.direct_run_loss_pct c29,
    defntn_step.drive_type_id c30,
    defntn_step.driving_cond_id c31,
    defntn_step.eng_pgm_nbr c32,
    defntn_step.engn_serial_nbr c33,
    defntn_step.envrnmtl_cond_id c34,
    defntn_step.ergo_rating_id c35,
    defntn_step.evaltn_complt_pct c36,
    defntn_step.evaltn_procdr_id c37,
    defntn_step.gca_50_or_safety_issue_flag c38,
    defntn_step.gca_value_amt c39,
    defntn_step.gm_rating_id c40,
    defntn_step.hardware_stage_id c41,
    defntn_step.incdnt_discvrd_by_nm c42,
    defntn_step.incdnt_discvr_dept_nm c43,
    defntn_step.incdnt_discvr_ph_nbr c44,
    defntn_step.incdnt_first_rptd_dt c45,
    defntn_step.incdnt_src_id c46,
    defntn_step.intrnl_measmt_info_owner_nm c47,
    defntn_step.intrnl_measmt_plt_faclty_id c48,
    defntn_step.intrnl_measmt_rpt_dt c49,
    defntn_step.issue_clasfn_id c50,
    defntn_step.issue_ctg_id c51,
    defntn_step.issue_intgrtn_id c52,
    defntn_step.modl_yr_id c53,
    defntn_step.modl_yr_qtr_id c54,
    defntn_step.odmtr_msmt_unit_id c55,
    defntn_step.odmtr_rdng_msmt_unit_id c56,
    defntn_step.odmtr_rdng_nbr c57,
    defntn_step.odmtr_rdng_beginning_nbr c58,
    defntn_step.odmtr_rdng_ending_nbr c59,
    defntn_step.part_drblty_msmt_unit_id c60,
    defntn_step.part_drblty_nbr c61,
    defntn_step.part_test_msmt_unit_id c62,
    defntn_step.part_test_nbr c63,
    defntn_step.pe_me_trial_issue_flag c64,
    defntn_step.pim_nbr c65,
    defntn_step.plt_asmbly_doc_nbr c66,
    defntn_step.productivity_nbr c67,
    defntn_step.suspect_parts_avbl_flag c68,
    defntn_step.suspect_parts_loc_txt c69,
    defntn_step.trnsmn_serial_nbr c70,
    defntn_step.veh_ident_nbr c71,
    defntn_step.veh_proprt_nbr c72,
    defntn_step.veh_test_msmt_unit_id c73,
    defntn_step.veh_test_nbr c74,
    defntn_step.vpps_id_nbr c75,
    defntn_step.wrkstn_id c76,
    defntn_step.road_surface_id c77,
    defntn_step.cost_redctn_rpt_dt c78,
    defntn_step.cost_redctn_trackg_nbr c79,
    defntn_step.cost_redctn_type_id c80,
    defntn_step.cust_survey_dt c81,
    defntn_step.warnty_impct_rpt_dt c82,
    defntn_step.field_prod_rpt_nbr c83
    FROM (SELECT DISTINCT mv_rpt_issue_all.project_id
    project_id,
    mv_rpt_issue_all.prts_prod_ln_id
    prts_prod_ln_id,
    mv_rpt_issue_all.issue_id issue_id,
    mv_rpt_issue_all.disply_issue_nbr
    disply_issue_nbr,
    mv_rpt_issue_all.issue_sevrty_cd
    issue_sevrty_cd,
    mv_rpt_issue_all.proj_nbr proj_nbr,
    mv_rpt_issue_all.issue_status_cd
    issue_status_cd,
    mv_rpt_issue_all.primry_metric_score_nbr
    primry_metric_score_nbr,
    mv_rpt_issue_all.issue_type_cd
    issue_type_cd,
    mv_rpt_issue_all.title title,
    mv_rpt_issue_all.prts_prod_ln_desc
    prts_prod_ln_desc
    FROM mv_rpt_issue_all,
    vw_sec_acs_grp_proj acs_grp_proj
    WHERE acs_grp_proj.acs_grp_id IN
    (1,
    4,
    42,
    43,
    44,
    51,
    52,
    53,
    54,
    266,
    366,
    386,
    526,
    546,
    547,
    548,
    566,
    846,
    946,
    966,
    1006,
    1066,
    1087
    AND mv_rpt_issue_all.prts_prod_ln_id =
    acs_grp_proj.prts_prod_ln_id
    AND mv_rpt_issue_all.project_id =
    acs_grp_proj.project_id
    AND mv_rpt_issue_all.issue_type_cd =
    'Current Production') vw_rpt_issue,
    vw_rpt_leadtime,
    vw_defntn_step defntn_step
    WHERE vw_rpt_issue.issue_id = vw_rpt_leadtime.issue_id
    AND vw_rpt_issue.issue_id = defntn_step.issue_id) d4,
    vw_rpt_incdnt_src_three_level,
    vw_rpt_warranty_labr_code,
    vw_rpt_prod_ln_grp,
    (SELECT t1.issue_id issue_id, t1.workflow_compnt_id workflow_compnt_id,
    t1.issue_step_status_cd issue_step_status_cd,
    t1.step_target_closed_dt step_target_closed_dt,
    t1.step_target_submit_dt step_target_submit_dt,
    t1.orig_user_full_nm orig_user_full_nm,
    t1.champ_user_full_nm champ_user_full_nm,
    t1.champ_org_nm champ_org_nm
    FROM prts_syst.vw_rpt_issue_step_dtl_all t1
    WHERE t1.current_step_flag = 'Y') t3,
    vw_complaint_ctg,
    root_cause_step,
    vw_prob_main_cause,
    Mv_RPT_CONCAT_ENGN_OPTN_ALL,
    vw_rpt_vpps_lvl,
    soltn_step,
    vw_rpt_defntn_all vw_rpt_defntn,
    vw_cust_survey_impct_dtl cust_survey_impct_dtl,
    vw_cust_survey_type
    WHERE d4.c46 = vw_rpt_incdnt_src_three_level.level3_incdnt_src_id(+)
    Or d4.c46=vw_rpt_incdnt_src_three_level.level2_incdnt_src_id(+))
    And vw_rpt_incdnt_src_three_level.level3_incdnt_src_id IS NULL
    AND d4.c2 = vw_rpt_warranty_labr_code.issue_id(+)
    AND d4.c1 = vw_rpt_prod_ln_grp.prts_prod_ln_id(+)
    AND d4.c2 = t3.issue_id(+)
    AND d4.c26 = vw_complaint_ctg.complaint_ctg_id(+)
    AND d4.c2 = root_cause_step.issue_id(+)
    AND root_cause_step.prob_main_cause_id = vw_prob_main_cause.prob_main_cause_id(+)
    AND d4.c2 = Mv_RPT_CONCAT_ENGN_OPTN_ALL.issue_id(+)
    AND d4.c75 = vw_rpt_vpps_lvl.vpps_id_nbr(+)
    AND d4.c2 = soltn_step.issue_id(+)
    AND d4.c2 = vw_rpt_defntn.issue_id(+)
    AND d4.c2 = cust_survey_impct_dtl.issue_id(+)
    AND cust_survey_impct_dtl.cust_survey_type_id = vw_cust_survey_type.cust_survey_type_id(+)
    AND vw_rpt_prod_ln_grp.prod_grp_desc IN
    ('DB Admin', 'GM - All Vehicles', 'GMAP - DAT', 'GMAP - Holden')
    AND d4.c6 IN
    ('Cancelled',
    'Closed',
    'Closed (w/o Action)',
    'Closed, Supporting Process(es) Active',
    'Draft',
    'Open'
    );

    Hi,
    Maestro_Vineet wrote:
    This is quite strange when i used the Old way of using Outer Joins(+), i encountered the Ora-01719 error saying Outer Joins not allowed in Or and IN operator.Whereas when i use the ANSI sql i query gets executed without any error.Any idea what might be the reason..is it that i myself is making mistake.No, I don't think you're making any mistake. Some things are simply not allowed with the "+" outer-join syntax.
    There are work-arounds, but they are harder to code and slower to run than simply using ANSI syntax.
    I recommend always using ANSI syntax, especially for outer joins.

  • Drag-n-n-drop query joins uses WHERE, not INNER JOIN syntax

    When I highlight a few tables and drag them onto the sql worksheet, it will build a select statement for me and join the tables by their foreign keys.
    That's a nice feature, thanks!
    Three questions. Is it possible to:
    1. get it to use the INNER JOIN and LEFT OUTER JOIN syntax instead of joining the tables in the WHERE clause?
    2. control the table aliases so that it will automatically use the "standard alias" for the table instead of A, B, C, etc.?
    3. get it to not put the schema name into the query?
    Thanks!
    Edited by: David Wendelken on Nov 22, 2008 1:48 PM. Grammar mistake.

    Hi Gopi,
    Your code is Good.
    But try to avoid Inner join with more number of Tables ...because this is a performance issue..
    try to use..
    select (primary key fields mainly,other fields) from LIKP into itab where bolnr in p_bolnr(paramater).
    next try to use for all entries option..
    select (primary key fields mainly,other fields) from VBFA for all entries in itab where (give the condition)....
    simillarly do for the other select ....ok this will try to reduce the performance issue....
    <b><REMOVED BY MODERATOR></b>
    Message was edited by:
            Alvaro Tejada Galindo

Maybe you are looking for