Outer Join Bug !!

Has anybody noticed there is a huge bug in Oracle 9.2.0.1 ?
SELECT STRS.Text, STRS.Language
FROM CTY LEFT OUTER JOIN STRS
ON (STRS.Language='de' AND CTY.LanguageId=STRS.Num)
returns:
1 , 'Deutsch' , 'de'
2 , 'Deutsch' , 'de'
BUT if the condition is replaced by
ON ('de'=STRS.Language AND CTY.LanguageId=STRS.Num)
it returns:
1 , 'nìmecky' , 'cs'
2 , 'nìmecky' , 'cs'
That means the condition "'de'=STRS.Language" is effectively ignored !!

I don't think that's a bug.
STRS.Language='de' is a where-condition and not a join-condition.
Try:
SELECT STRS.Text, STRS.Language
FROM CTY LEFT OUTER JOIN STRS
ON ( AND CTY.LanguageId=STRS.Num)
WHERE STRS.Language='de';

Similar Messages

  • Full outer join Bug or my misunderstanding?

    CREATE GLOBAL TEMPORARY TABLE BP_ATTRIBUTE_CHARVAL_GTT
       (     "ATTRIBUTE_ID" NUMBER(10,0),
         "PARTNER_ID" NUMBER(10,0),
         "CHAR_VALUE" VARCHAR2(4000 BYTE),
         "LAST_UPDATE_DATE" DATE,
         "DISABLE_DATE" DATE
       ) ON COMMIT DEETE ROWS ;
    CREATE  TABLE BP_ATTRIBUTE_CHARVAL
       (     "ATTRIBUTE_ID" NUMBER(10,0),
         "PARTNER_ID" NUMBER(10,0),
         "CHAR_VALUE" VARCHAR2(4000 BYTE),
         "LAST_UPDATE_DATE" DATE,
         "DISABLE_DATE" DATE
    REM INSERTING into BP_ATTRIBUTE_CHARVAL
    Insert into BP_ATTRIBUTE_CHARVAL (ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (888854,710326,'1',to_date('29-NOV-06','DD-MON-RR'),to_date('01-JAN-06','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL (ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591330,710326,'01',to_date('09-FEB-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL (ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591321,710326,'N',to_date('09-FEB-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL (ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591331,710326,'00',to_date('09-FEB-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL (ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591329,710326,'01',to_date('09-FEB-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL (ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591332,710326,'01',to_date('09-FEB-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL (ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591324,710326,'2',to_date('09-FEB-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL (ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591333,710326,'01',to_date('09-FEB-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL (ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591323,710326,'X1',to_date('09-FEB-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL (ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591334,710326,'BS',to_date('09-FEB-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    REM INSERTING into BP_ATTRIBUTE_CHARVAL_GTT
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591330,707408,'01',to_date('29-MAR-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591321,707408,'N',to_date('23-JAN-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591331,707408,'00',to_date('23-JAN-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591329,707408,'01',to_date('23-JAN-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591332,707408,'00',to_date('29-MAR-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591324,707408,'2',to_date('29-MAR-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591333,707408,'01',to_date('23-JAN-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591323,707408,'X1',to_date('23-JAN-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591334,707408,'BS',to_date('23-JAN-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (876570,707408,'01',to_date('29-MAR-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT (ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (876568,707408,'1234560003264801',to_date('29-MAR-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (876569,707408,'f3a1d996-720e-4e0a-989c-6d4f3e8e629a',to_date('29-MAR-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (874948,707408,'20060318000000',to_date('29-MAR-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    select 707408,    
           decode(g.attribute_id,NULL,c.attribute_id,g.attribute_id) attribute_id,
           case
           when c.last_update_date is null and g.last_update_date is not null
           then
              g.char_value
            when g.last_update_date is null and c.last_update_date is not null 
            then
              c.char_value
            when g.last_update_date >= c.last_update_date
            then
                 g.char_value
           else
                c.char_value
           end   char_value,        
           decode(g.last_update_date,c.last_update_date,g.last_update_date,c.last_update_date) last_update_date,
           decode(g.disable_date,c.disable_date,g.disable_date,c.disable_date) disable_date
    from bp_attribute_charval_gtt g
    full outer join
         bp_attribute_charval c
    on c.attribute_id = g.attribute_id    
    where c.partner_id=710326;Hi Guys
    When I run the above query I get a problem.
    I am expecting to see is a merge of all the attribute_id's and their values.
    The query does not appear to be merging the data as intended.
    My understanding of the full outer join is that its a combination of left and outer joins,
    so the above query is intended to return with the total number of unique attributes
    and their appropriate values
    a) I have a bug in the Sql
    b) This is an oracle bug
    c) My understanding is incorrect
    Please Help
    Message was edited by:
    Keith Jamieson (fixed insert statements for gtt )

    How do you expect a full outer join operation when you have given --
    where c.partner_id=710326;According to your supplied data - i don't think your query can perform that full outer join operation because of that filtration. Just remove that last condition and checked it. You will get your desired result - hopefully.
    "It's like you want to view the things by closing down your both eyes". Do you think it will pay?
    Regards.
    Satyaki De.

  • Left outer join Bug? Oracle 11 g.

    Hi , I am facing a strange problem in oracle 11 g .
    I have a select query like this
    Query 1 :
    Select A.name, B.name, C.name from A Left outer join B on A.id = B.id left outer join C on b.id = c.id and (Some complex condition) left outer join D on C.id = D.id;
    A, B, C, D are tables.
    (Assume that I have data which satisfies the above join conditions)
    However I am not getting C.name in the result. Getting NULL in C.name.
    Now if I add a where clause to the above query like the following Query 2 then I get C.name in the results
    Consider that there is a field called field1 in table C and the value of field1 is ‘xyz’ for all the rows of table C .
    Query 2 :
    Select A.name, B.name, C.name from A Left outer join B on A.id = B.id left outer join C on b.id = c.id and (Some complex condition) left outer join D on C.id = D.id where c.field1 = ‘xyz’;
    I find this strange , What role where clause is playing ? Why I get C.name only after adding where clause.
    I also tried following setting with Query 1 however this also did not help me.
    alter session set "_optimizer_join_elimination_enabled"=false;
    Is oracle does some optimization if no where clause is specified ? Is this a bug?
    Please help me out.
    Thanks,
    Sumit

    874384 wrote:
    ...Is this a bug? Maybe. Maybe not. Really difficult to say based on your description. However, if you suspect a bug, then raise a ticket to the support including much more information (e.g. version 11.x.x.x, define "some condition" and so on).
    Nicolas.

  • Datawindow graphical syntax outer join BUG

    Ok, so this is a bug report.  I don't know where i'm supposed to post it for SAP (i do have support).
    The outer join syntax is ansi.
    Using the graphical SQL designer, outer joins are incorrectly written by powerbuilder.  This has been going on ever since ANSI style outer join sytax was added (PB 9?).
    I think it has to do with the datawindow's use of both right and outer joins and its lack of use of inner joins.  The end result is that we have to rewrite a lot of stuff in sql since powerbuilder is generating bad sql.
    The typical example is the use of 2 or more outer joins where the joins are being done using 2 or more columns.
    PB will create both a LEFT and a RIGHT outer join by duplicating the table name.  The table (receive) is only selected ONCE in the sql graphical designer.
    And this is the result:
    Microsoft SQL Native Client
    The objects "receive" and "receive" in the FROM clause have the same exposed names. Use correlation names to distinguish them.
    Do you want to correct errors?
    I would love to see the datawindow sql corrected and written in a more standard way.
    1 change the OUTER JOIN syntax in the db profile setup to indicate the syntax.  not outer join, but syntax.  If you select ANSI have it write ALL joins using JOIN ( from ta join tb on ta.col = tb.col) intead of from tablea, tableb where tablea.col = tableb.col
    2 - eliminate the use of right outer joins.
    At that point i believe that the datawindow could more easily be fixed by SAP to not duplicate tables when in generates the syntax.

    If you have an Oracle Support agreement you can log a Service Request with Oracle, but they may respond that it is not really a bug. The problem is that the "outer" keyword in your 3rd example is being treated as an alias for TABLE_A because it is not considered a reserved keyword.
    with table_a as (
    select 1 as id, 'abc' as value_a from dual union all
    select 2 as id, 'def' as value_a from dual union all
    select 3 as id, 'ghi' as value_a from dual
    , table_b as (
    select 2 as id, 'jkl' as value_b from dual union all
    select 3 as id, 'mno' as value_b from dual union all
    select 4 as id, 'pqr' as value_b from dual
    select ID, outer.VALUE_A, VALUE_B from TABLE_A outer join TABLE_B using (ID);
    ID                     VALUE_A VALUE_B
    2                      def     jkl
    3                      ghi     mnoIf you query the V$RESERVED_WORDS view it will tell you which keywords are reserved.
    select * from V$RESERVED_WORDS where keyword in ('OUTER', 'SELECT','USING');
    KEYWORD                        LENGTH                 RESERVED RES_TYPE RES_ATTR RES_SEMI DUPLICATE
    USING                          5                      N        N        N        N        N
    OUTER                          5                      N        N        N        N        N
    SELECT                         6                      Y        N        N        N        NYou would get a similar result if you tried
    select ID, VALUE_A, VALUE_B from TABLE_A using join TABLE_B using (ID);Regards,
    Bob

  • Full outer join ---  bug? Urgent

    Hi,
    I have a simple mapping using 2 source tables and doing an full outer join. While executing the mapping it is throwing me out with an error --
    Starting Execution LOAD_SAP
    Starting Task LOAD_SAP
    ORA-01790: expression must have same datatype as corresponding expression
    ORA-02063: preceding line from ODSD@LOC_TGT_LOC_ODSD
    ORA-06512: at "DWH_USER.LOAD_SAP", line 12
    ORA-06512: at "DWH_USER.LOAD_SAP", line 481
    ORA-06512: at "DWH_USER.LOAD_SAP", line 795
    ORA-06512: at "DWH_USER.LOAD_SAP", line 1973
    ORA-06512: at line 1
    Completing Task LOAD_SAP
    Completing Execution LOAD_SAP
    The SQL generated at line 12 is -
    CURSOR "JOIN_c" IS
    SELECT
    /*+ DRIVING_SITE("CONNECTION_LOC_TGT_LOC_ODSD") */
    "CONNECTION_LOC_TGT_LOC_ODSD"."END_USER_CUST_ID" "END_USER_CUST_ID",
    "SERVICE_LOC_TGT_LOC_ODSD"."SERVICE_NAME" "SERVICE_NAME",
    "CONNECTION_LOC_TGT_LOC_ODSD"."CE_CLLI" "CE_CLLI",
    "CONNECTION_LOC_TGT_LOC_ODSD"."PE_CLLI" "PE_CLLI"
    FROM "ODS"."CONNECTION"@"ODSD"@"LOC_TGT_LOC_ODSD" "CONNECTION_LOC_TGT_LOC_ODSD"
    FULL OUTER JOIN "ODS"."SERVICE"@"ODSD"@"LOC_TGT_LOC_ODSD" "SERVICE_LOC_TGT_LOC_ODSD" ON ("CONNECTION_LOC_TGT_LOC_ODSD"."END_USER_CUST_ID" = "SERVICE_LOC_TGT_LOC_ODSD"."END_USER_CUST_ID") ;
    If I replace the Full outer join with an equi join everything works fine. The SQL generated with an equi-join is ---
    SELECT
    /*+ DRIVING_SITE("CONNECTION_LOC_TGT_LOC_ODSD") */
    "CONNECTION_LOC_TGT_LOC_ODSD"."END_USER_CUST_ID" "END_USER_CUST_ID",
    "SERVICE_LOC_TGT_LOC_ODSD"."SERVICE_NAME" "SERVICE_NAME",
    "CONNECTION_LOC_TGT_LOC_ODSD"."CE_CLLI" "CE_CLLI",
    "CONNECTION_LOC_TGT_LOC_ODSD"."PE_CLLI" "PE_CLLI"
    FROM "ODS"."CONNECTION"@"ODSD"@"LOC_TGT_LOC_ODSD" "CONNECTION_LOC_TGT_LOC_ODSD",
    "ODS"."SERVICE"@"ODSD"@"LOC_TGT_LOC_ODSD" "SERVICE_LOC_TGT_LOC_ODSD" WHERE ( "CONNECTION_LOC_TGT_LOC_ODSD"."END_USER_CUST_ID" = "SERVICE_LOC_TGT_LOC_ODSD"."END_USER_CUST_ID" );
    We are using Oracle 9.2.0.4 AND OWB Clinet 9.2.0.2.8 and runtime repository 9.2.0.2.0.
    Any help on this appreciated?

    The discussion on this thread has moved to the later thread Problem with JOINs
    Nikolai

  • Issue with Outer Join (Possible Bug)

    Hi,
    I am using Toplink 10.3.3 with oracle as db. I noticed that if I use outer joins with collections, then toplink doesnt add (+) sign to the where clause of the collection.
    For e.g. for a relationship - Employee has projects, if I do an outer join on projects and also provide a where clause for projects collection, the query doesnt include the (+) sign in it.
    Expression expr = builder.anyOfAllowingNone("projects").getAllowingNull("anotherOne-OneMapping").get("attr").equal("Value")
    This expr goes in the where clause and TopLink does not generate (+) in the query alongside attr = "Value"
    I have tried this from workbench as well as Java. Could anyone please confirm that the above scenario works? May be this is a bug in toplink !
    TIA
    Ani

    I too have found a few bugs with full outer joins. Many of them have been fixed in 9iR2 though.
    Like this one simple one on unpatched 9iR1: select foo1.x, foo2.x
    from foo1 full outer join (select * from foo2 where x = :bindx) foo2 on (foo1.y = foo2.y)
    ERROR at line 2:
    ORA-00600: internal error code, arguments: [qctcte1], 0], [], [], [], [], [], []Fixed here: Hdr: 2458655 9.0.1.3.0 RDBMS 9.0.1.3.0 SQL LANGUAGE PRODID-5 PORTID-453
    Abstract: ORA-600 [QCTECTE1] ON QUERY WITH FULL OUTER JOIN AND BIND VARIABLES

  • Strange bug with Full Outer Join

    Hi guys,
    can you please confirm this behaviour on 11gR2? It used to work fine on 10gR1.
    Small test case:
    create table TEST_OBJECT_METADATA
      project_name  VARCHAR2(30 CHAR) not null,
      object_id     NUMBER not null
    create table TEST_OBJECT_INFO
      object_id          NUMBER not null,
      object_type        VARCHAR2(30) not null
    create table TEST_SUPPORTED_OBJECTS
      object_type    VARCHAR2(30 CHAR) not null,
      enabled        NUMBER(1));
    INSERT INTO TEST_OBJECT_METADATA VALUES ('NEW',1);
    INSERT INTO TEST_OBJECT_INFO VALUES (1, 'TABLE');
    INSERT INTO TEST_SUPPORTED_OBJECTS VALUES ('TABLE',1);
    COMMIT;When I execute the following query:
    WITH old_project AS
    (SELECT oi.object_type,
             oi.object_id
        FROM test_object_metadata om,
             test_object_info     oi
       WHERE om.object_id = oi.object_id
         AND project_name = 'OLD'),
    new_project AS
    (SELECT oi.object_type,
             oi.object_id
        FROM test_object_metadata om,
             test_object_info     oi
       WHERE om.object_id = oi.object_id
         AND project_name = 'NEW')
    SELECT src.object_type,
               t.enabled
      FROM (SELECT nvl(o.object_type, n.object_type) object_type
              FROM old_project o
              FULL OUTER JOIN new_project n
                ON o.object_id = n.object_id) src,
           test_supported_objects t
    WHERE src.object_type = t.object_type(+);I get the following output:
    OBJECT_TYPE     ENABLED
    TABLE             So, the outer join to test_supported_objects does not match.
    But if I force the FULL OUTER JOIN to run first using rownum:
    WITH old_project AS
    (SELECT oi.object_type,
             oi.object_id
        FROM test_object_metadata om,
             test_object_info     oi
       WHERE om.object_id = oi.object_id
         AND project_name = 'OLD'),
    new_project AS
    (SELECT oi.object_type,
             oi.object_id
        FROM test_object_metadata om,
             test_object_info     oi
       WHERE om.object_id = oi.object_id
         AND project_name = 'NEW')
    SELECT src.object_type,
               t.enabled
      FROM (SELECT nvl(o.object_type, n.object_type) object_type,
                           rownum
              FROM old_project o
              FULL OUTER JOIN new_project n
                ON o.object_id = n.object_id) src,
           test_supported_objects t
    WHERE src.object_type = t.object_type(+);I get the expected output:
    OBJECT_TYPE     ENABLED
    TABLE             1 Thanks in advance.

    Without mixing works fine:
    WITH old_project AS
    (SELECT oi.object_type,
             oi.object_id
        FROM test_object_metadata om,
             test_object_info     oi
       WHERE om.object_id = oi.object_id
         AND project_name = 'OLD'),
    new_project AS
    (SELECT oi.object_type,
             oi.object_id
        FROM test_object_metadata om,
             test_object_info     oi
       WHERE om.object_id = oi.object_id
         AND project_name = 'NEW')
    SELECT src.object_type,
           t.enabled
      FROM (SELECT nvl(o.object_type, n.object_type) object_type
              FROM old_project o,
                   new_project n   
              where  o.object_id = n.object_id(+)
              UNION
              SELECT nvl(o.object_type, n.object_type) object_type
              FROM old_project o,
                   new_project n   
              where  o.object_id(+) = n.object_id) src,
           test_supported_objects t
    WHERE src.object_type = t.object_type(+);but there shouldn't be any restrictions on mixing them, right?

  • Query builder bug in outer joins ?

    I understood that if you were joining two tables A and B, the following was a
    LEFT OUTER JOIN
    SELECT A.COL, B.COL
    FROM A, B
    WHERE A.ID = B.ID (+)
    ie: a LEFT outer join has the (+) on the Right-hand table.
    However, query builder puts the (+) on the Left-hand table.
    Same for a RIGHT outer join - I think the (+) should be on the Left-hand table, but query builder puts it on the Right-hand table.
    Cheers,
    Andrew
    (running Version 2.1.0.00.39)

    Hi Andrew,
    I just played a little with the query builder and created a join between two of my tables:
    PROJECTS and ACTIVITIES, linked via KCC.
    When I create a left outer join in query builder, I get the following result:
    select     "PROJECTS"."KCC" as "KCC"
    from     "ACTIVITIES" "ACTIVITIES",
         "PROJECTS" "PROJECTS"
    where "PROJECTS"."KCC"(+) ="ACTIVITIES"."KCC"
    Which is correct: Left refers to the first table in the from clause (ACTIVITIES) and places the (+) on the other table!
    Left and right refers to the order of tables in the from clause, not in the where clause. Query builder sorts the tables in FROM alphabetically, maybe this is differing from the graphical order in query builder.
    Regards
    Alex

  • 3.2, BC4J, outer joins, insert, lookup, bug

    I have a table voyage that has a foreign key to routes. This relation is not mandatory.
    I created a frame that shows the voyage. I use an outer join to show the route name if there is a route
    SELECT voyage.ID
    ,voyage.Name
    , voyage.routeID
    , route.ID
    , route.Name
    WHERE voyage.routeID = route.ID(+)
    FROM voyage, route
    This works fine for selecting rows. But when I insert a new voyage and try to commit it, I get an error message that route.ID is not allowed to be NULL.
    Any suggestions?
    TIA

    Hello Folks!
    I would like to bring this topic up again!
    We have problems using view objects with outer joins, too.
    In JDev 3.1 we finally managed to handle things a bit. All worked fine except of deleting a record! No chance here!
    So we prayed for better behaviour in JDev 3.2.2. But as it seems it's getting even worse. I just checked our application.
    Here are the results:
    - In the Business Component Tester everything works fine. No errors.
    - As generated business component data form in applet I can't insert a record. The joke is that deleting now is possible!!! The error I get is:
    "AttributeInfo: cannot insert null into..". When I remove all AttributeInfos named by the error messages all works fine. But that's no solution cause we need these information!
    thanks for any help on this.
    null

  • BI Infoset left outer join  (NW04s)

    I created an Infoset using a left outer join for infoproviders:
    - 0FIGL_O10 (GL transaction figures - DSO )
    - 0CCA_C03 (CCA Statistical key figures - CUBE)
    DSO 0FIGL_O10 is the left table with joins on:
    - 0COSTCENTER
    - 0FISCPER
    The data set returned by Infoset appears to be based on a SQL using an
    inner join.
    This appears to be a bug.
    We are on BI 700 SP 15.

    Hi Raynald - I did a demo with few records and it works fine for me.  We are on 7, SP14.

  • Problem with XMLTABLE and LEFT OUTER JOIN

    Hi all.
    I have one problem with XMLTABLE and LEFT OUTER JOIN, in 11g it returns correct result but in 10g it doesn't, it is trated as INNER JOIN.
    SELECT * FROM v$version;
    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 Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    --test for 11g
    CREATE TABLE XML_TEST(
         ID NUMBER(2,0),
         XML XMLTYPE
    INSERT INTO XML_TEST
    VALUES
         1,
         XMLTYPE
              <msg>
                   <data>
                        <fields>
                             <id>g1</id>
                             <dat>data1</dat>
                        </fields>
                   </data>
              </msg>
    INSERT INTO XML_TEST
    VALUES
         2,
         XMLTYPE
              <msg>
                   <data>
                        <fields>
                             <id>g2</id>
                             <dat>data2</dat>
                        </fields>
                   </data>
              </msg>
    INSERT INTO XML_TEST
    VALUES
         3,
         XMLTYPE
              <msg>
                   <data>
                        <fields>
                             <id>g3</id>
                             <dat>data3</dat>
                        </fields>
                        <fields>
                             <id>g4</id>
                             <dat>data4</dat>
                        </fields>
                        <fields>
                             <dat>data5</dat>
                        </fields>
                   </data>
              </msg>
    SELECT
         t.id,
         x.dat,
         y.seqno,
         y.id_real
    FROM
         xml_test t,
         XMLTABLE
              '/msg/data/fields'
              passing t.xml
              columns
                   dat VARCHAR2(10) path 'dat',
                   id XMLTYPE path 'id'
         )x LEFT OUTER JOIN
         XMLTABLE
              'id'
              passing x.id
              columns
                   seqno FOR ORDINALITY,
                   id_real VARCHAR2(30) PATH '.'
         )y ON 1=1
    ID     DAT     SEQNO     ID_REAL
    1     data1     1     g1
    2     data2     1     g2
    3     data3     1     g3
    3     data4     1     g4
    3     data5          Here's everything fine, now the problem:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
    PL/SQL Release 10.2.0.1.0 - Production
    "CORE     10.2.0.1.0     Production"
    TNS for HPUX: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    --exactly the same environment as 11g (tables and rows)
    SELECT
         t.id,
         x.dat,
         y.seqno,
         y.id_real
    FROM
         xml_test t,
         XMLTABLE
              '/msg/data/fields'
              passing t.xml
              columns
                   dat VARCHAR2(10) path 'dat',
                   id XMLTYPE path 'id'
         )x LEFT OUTER JOIN
         XMLTABLE
              'id'
              passing x.id
              columns
                   seqno FOR ORDINALITY,
                   id_real VARCHAR2(30) PATH '.'
         )y ON 1=1
    ID     DAT     SEQNO     ID_REAL
    1     data1     1     g1
    2     data2     1     g2
    3     data3     1     g3
    3     data4     1     g4As you can see in 10g I don't have the last row, it seems that Oracle 10g doesn't recognize the LEFT OUTER JOIN.
    Is this a bug?, Metalink says that sometimes we can have an ORA-0600 but in this case there is no error returned, just incorrect results.
    Please help.
    Regards.

    Hi A_Non.
    Thanks a lot, I tried with this:
    SELECT
         t.id,
         x.dat,
         y.seqno,
         y.id_real
    FROM
         xml_test t,
         XMLTABLE
              '/msg/data/fields'
              passing t.xml
              columns
                   dat VARCHAR2(10) path 'dat',
                   id XMLTYPE path 'id'
         )x,
         XMLTABLE
              'id'
              passing x.id
              columns
                   seqno FOR ORDINALITY,
                   id_real VARCHAR2(30) PATH '.'
         )(+) y ;And is giving me the complete output.
    Thanks again.
    Regards.

  • Problem with outer joins and the class indicator/discriminator

    Hello,
    I am having a problem defining a query in toplink (10.1.3.3).
    In the workbench, I have created a parent and 2 child descriptors. The parent is "AbstractValue", the children are "DefaultValue", classified by the discriminator 'DEF', and "OverrideValue", classified by 'OVR', both located in the same table.
    Another descriptor (containing a one-on-one mapping to both a "DefaultValue", and a "OverrideValue") needs to be queried for its 'value'.
    The way the query should act is: If an override value (row) exists, this one applies for that object. If an override doesn't exist, return the default value.
    The query then comes down to (as I have it now):
    builder.getAllowingNull("OverrideValue").getAllowingNull("value").ifNull(builder.get("DefaultValue").get("value")).equal(builder.getParameter(VALUE_PARAM));
    The problem is that toplink adds the distinction for the different kind of "values" in the where clause WITHOUT checking for null values e.g. it performs an outer join, but then still checks for the discriminator value thus
    ....t1.ovr_id = t2.id(+) AND t2.discriminator = 'OVR' AND ...
    instead of
    ... LEFT JOIN values t2 ON (t1.ovr_id = t2.id AND t2.discriminator = 'OVR') ...
    This leads to the behaviour that the query returns ONLY the objects that have override and default values.
    An overview of the queries (simplified)
    Toplink, at the moment, returns only results if both override and default values exists:
    SELECT t1.id
    t1.def_id,
    t1.ovr_id
    FROM values t2,
    parameter t1,
    values t0
    WHERE nvl(t2.value, t0.value) = 15 AND
    t1.ovr_id = t2.id(+) AND t2.discriminator = 'OVR' AND
    t1.def_id = t0.id AND t0.discriminator = 'DEF'
    Situation Wanted:
    SELECT t1.id
    t1.def_id,
    t1.ovr_id
    FROM parameter t1
    LEFT JOIN values t2 ON (t1.ovr_id = t2.id AND t2.discriminator = 'OVR')
    JOIN values t0 ON (t1.def_id = t0.id AND t0.discriminator = 'DEF')
    WHERE nvl(t2.value, t0.value) = 15
    Anyone know if there is some statement I am missing to allow an actual outer join on descriptors containing class indicators/discriminators? A possible rewrite?
    Thanks in advance,
    Rudy

    This is a bug in TopLink's outer join support for Oracle. Currently the outer join is put in the where clause, instead of the from clause, as we do on other platforms. You might be able to fix it by changing your OraclePlatform to return false for shouldPrintOuterJoinInWhereClause().
    Please log this bug on EclipseLink, or through Oracle technial support.
    There is a workaround using,
    descriptor.getInhertiancePolicy().setAlwaysUseOuterJoinForClassType(true);
    James : http://www.eclipselink.org

  • Not using Index when SDO_RELATE in Spatial Query is used in LEFT OUTER JOIN

    I want to know for every City (Point geometry) in which Municipality (Polygon geometry) it is.
    Some cities will not be covered by any municipality (as there is no data for it), so its municipality name should be blank in the result
    We have 4942 cities (point geometries)
    and 500 municipalities (polygon geometry)
    SELECT T1.NAME as City, T2.NAME as Municipality
    FROM CITY T1
    LEFT OUTER JOIN MUNICIPALITY T2 ON SDO_RELATE(T1.GEOM, T2.GEOM, 'MASK=ANYINTERACT') = 'TRUE'The explain plan for this query is:
    SELECT STATEMENT
      FILTER
        Filter Predicates
          MDSYS.SDO_RTREE_RELATE(T1.GEOM, T2.GEOM, 'mask=ANYINTERACT querytype=window ') = 'TRUE'
        MERGE JOIN
          TABLE ACCESS              CITY               FULL                            11
          BUFFER                                       SORT                        100605
              TABLE ACCESS          MUNICIPALITY       FULL                            20So the cost is in the BUFFER (whatever that is), it takes +2000 seconds to run this, it is not using the spatial index.
    And we are not getting all rows, but only the ones interacting with a municipality, e.g. 2436 rows.
    But I want all rows, including the ones not interacting with any Municipality.
    When we want only those cities that actually are in a municipality, I use a different query and it will use the index.
    SELECT T1.NAME as City, T2.NAME as Municipality
    FROM CITY T1, MUNICIPALITY T2
    WHERE SDO_RELATE(T1.GEOM, T2.GEOM, 'MASK=ANYINTERACT') = 'TRUE'I get (only) 2436 rows (as expected) in 5 seconds (it is fast) and the explain plan shows it is using the spatial index.
    But in this case, I am not getting any cities not inside any municipality (of course)
    SELECT STATEMENT
       NESTED LOOPS
          TABLE ACCESS                   MUNICIPALITY       FULL                22
          TABLE ACCESS                   CITY               BY INDEX ROWID      22
             DOMAIN INDEX                CITY_SDX                                0
                Access Predicates
                   MDSYS.SDO_RTREE_RELATE(T1.GEOM, T2.GEOM, 'mask=ANYINTERACT querytype=window ') = 'TRUE'I always thought a LEFT OUTER JOIN would return all rows from the Table, whatever happens in the next,
    but it seems the query has been rewritten so that it is now using a Filter Predicate in the end, which filters those geometries having no interaction.
    As an example I also do thing alphanumerically, I do get 4942 rows, including the ones which have no Municipality name.
    In this case the names must match, so its only for testing if the LEFT OUTER JOIN returns stuff correctly, which it does in this case.
    SELECT T1.NAME as City, T2.NAME as Municipality
    FROM CITY T1
    LEFT OUTER JOIN MUNICIPALITY T2 ON T1.NAME = T2.NAMEIs this an Oracle Spatial bug, e.g. not return 4942 rows, but only 2436 rows on the first query?
    Note all tests performed on Oracle 11g R2 (11.2.0.1.0)

    Patrick,
    Even so, your geoms in the relate were the wrong way around.
    Also, I don't recall you saying (or showing) that you wanted the municipality geometry returned. Still,
    no matter, easy to do.
    Here are some additional suggestions. I don't have your data so I have had to use some of my own.
    set serveroutput on timing on autotrace on
    SELECT T1.SPECIES as City,
           (SELECT T2.ADMIN_NAME FROM AUSTRALIAN_STATES T2 WHERE SDO_ANYINTERACT(T2.GEOM, SDO_GEOM.SDO_BUFFER(T1.GEOM,10000,0.5,'UNIT=M')) = 'TRUE') as Municipality,
           (SELECT T2.GEOM       FROM AUSTRALIAN_STATES T2 WHERE SDO_ANYINTERACT(T2.GEOM, SDO_GEOM.SDO_BUFFER(T1.GEOM,10000,0.5,'UNIT=M')) = 'TRUE') as geom
      FROM GUTDATA T1;
    762 rows selected
    Elapsed: 00:00:21.656
    Plan hash value: 2160035213
    | Id  | Operation                   | Name                       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |                            |   762 | 49530 |     5   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| AUSTRALIAN_STATES          |     1 |   115 |     0   (0)| 00:00:01 |
    |*  2 |   DOMAIN INDEX              | AUSTRALIAN_STATES_GEOM_SPX |       |       |     0   (0)| 00:00:01 |
    |   3 |  TABLE ACCESS BY INDEX ROWID| AUSTRALIAN_STATES          |     1 |   115 |     0   (0)| 00:00:01 |
    |*  4 |   DOMAIN INDEX              | AUSTRALIAN_STATES_GEOM_SPX |       |       |     0   (0)| 00:00:01 |
    |   5 |  TABLE ACCESS FULL          | GUTDATA                    |   762 | 49530 |     5   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("MDSYS"."SDO_ANYINTERACT"("T2"."GEOM","SDO_GEOM"."SDO_BUFFER"(:B1,10000,0.5,'UNIT=M'))='TRUE')
       4 - access("MDSYS"."SDO_ANYINTERACT"("T2"."GEOM","SDO_GEOM"."SDO_BUFFER"(:B1,10000,0.5,'UNIT=M'))='TRUE')
       Statistics
                   7  user calls
               24576  physical read total bytes
                   0  physical write total bytes
                   0  spare statistic 3
                   0  commit cleanout failures: cannot pin
                   0  TBS Extension: bytes extended
                   0  total number of times SMON posted
                   0  SMON posted for undo segment recovery
                   0  SMON posted for dropping temp segment
                   0  segment prealloc tasksThe above can look messy as you add more (SELECT ...) attributes, but is is fast (though can't use in Materialized Views).
    /* The set of all cities not in municipalities */
    SELECT T1.SPECIES                 as City,
           cast(null as varchar2(42)) as municipality,
           cast(null as sdo_geometry) as geom
      FROM GUTDATA T1
    WHERE NOT EXISTS (SELECT 1
                         FROM AUSTRALIAN_STATES T2
                        WHERE SDO_ANYINTERACT(T2.GEOM, SDO_GEOM.SDO_BUFFER(T1.GEOM,10000,0.5,'UNIT=M')) = 'TRUE')
    UNION ALL
    /* The set of all cities in municipalities */
    SELECT T1.SPECIES    as City,
           T2.ADMIN_NAME as Municipality,
           T2.GEOM       as geom
      FROM GUTDATA T1
           INNER JOIN
           AUSTRALIAN_STATES T2 ON (SDO_ANYINTERACT(T2.GEOM, SDO_GEOM.SDO_BUFFER(T1.GEOM,10000,0.5,'UNIT=M')) = 'TRUE');
    762 rows selected
    Elapsed: 00:00:59.953
    Plan hash value: 2854682795
    | Id  | Operation           | Name                       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT    |                            |    99 | 13450 |    38  (87)| 00:00:01 |
    |   1 |  UNION-ALL          |                            |       |       |            |          |
    |*  2 |   FILTER            |                            |       |       |            |          |
    |   3 |    TABLE ACCESS FULL| GUTDATA                    |   762 | 49530 |     5   (0)| 00:00:01 |
    |*  4 |    DOMAIN INDEX     | AUSTRALIAN_STATES_GEOM_SPX |       |       |     0   (0)| 00:00:01 |
    |   5 |   NESTED LOOPS      |                            |    61 | 10980 |    33   (0)| 00:00:01 |
    |   6 |    TABLE ACCESS FULL| AUSTRALIAN_STATES          |     8 |   920 |     3   (0)| 00:00:01 |
    |*  7 |    TABLE ACCESS FULL| GUTDATA                    |     8 |   520 |     4   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - filter( NOT EXISTS (SELECT 0 FROM "AUSTRALIAN_STATES" "T2" WHERE "MDSYS"."SDO_ANYINTERACT"("T2"."GEOM","SDO_GEOM"."SDO_BUFFER"(:B1,10000,0.5,'UNIT=M'))='TRUE'))
       4 - access("MDSYS"."SDO_ANYINTERACT"("T2"."GEOM","SDO_GEOM"."SDO_BUFFER"(:B1,10000,0.5,'UNIT=M'))='TRUE')
       7 - filter("MDSYS"."SDO_ANYINTERACT"("T2"."GEOM","SDO_GEOM"."SDO_BUFFER"("T1"."GEOM",10000,0.5,'UNIT=M'))='TRUE')
       Statistics
                   7  user calls
              131072  physical read total bytes
                   0  physical write total bytes
                   0  spare statistic 3
                   0  commit cleanout failures: cannot pin
                   0  TBS Extension: bytes extended
                   0  total number of times SMON posted
                   0  SMON posted for undo segment recovery
                   0  SMON posted for dropping temp segment
                   0  segment prealloc tasksMuch slower but Materialized View friendly.
    This one is a bit more "natural" but still slower than the first.
    set serveroutput on timing on autotrace on
    /* The set of all cities in municipalities */
    WITH municipal_cities As (
      SELECT T1.ID         as City,
             T2.ADMIN_NAME as Municipality,
             T2.GEOM       as geom
        FROM GUTDATA T1
             INNER JOIN
             AUSTRALIAN_STATES T2 ON (SDO_ANYINTERACT(T2.GEOM, SDO_GEOM.SDO_BUFFER(T1.GEOM,10000,0.5,'UNIT=M')) = 'TRUE')
    SELECT T1.ID           as City,
           T2.Municipality as Municipality,
           T2.GEOM         as geom
      FROM GUTDATA          T1
           LEFT OUTER JOIN
           municipal_cities T2
           ON (T2.CITY = T1.ID);
    762 rows selected
    Elapsed: 00:00:50.228
    Plan hash value: 745978991
    | Id  | Operation             | Name              | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT      |                   |   762 | 44196 |    36   (3)| 00:00:01 |
    |*  1 |  HASH JOIN RIGHT OUTER|                   |   762 | 44196 |    36   (3)| 00:00:01 |
    |   2 |   VIEW                |                   |    61 |  3294 |    33   (0)| 00:00:01 |
    |   3 |    NESTED LOOPS       |                   |    61 | 10980 |    33   (0)| 00:00:01 |
    |   4 |     TABLE ACCESS FULL | AUSTRALIAN_STATES |     8 |   920 |     3   (0)| 00:00:01 |
    |*  5 |     TABLE ACCESS FULL | GUTDATA           |     8 |   520 |     4   (0)| 00:00:01 |
    |   6 |   INDEX FAST FULL SCAN| GUTDATA_ID_PK     |   762 |  3048 |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - access("T2"."CITY"(+)="T1"."ID")
       5 - filter("MDSYS"."SDO_ANYINTERACT"("T2"."GEOM","SDO_GEOM"."SDO_BUFFER"("T1"."GEOM",10000,0.5,'UNIT=M'))='TRUE')
       Statistics
                   7  user calls
               49152  physical read total bytes
                   0  physical write total bytes
                   0  spare statistic 3
                   0  commit cleanout failures: cannot pin
                   0  TBS Extension: bytes extended
                   0  total number of times SMON posted
                   0  SMON posted for undo segment recovery
                   0  SMON posted for dropping temp segment
                   0  segment prealloc tasksFinally, the Pièce de résistance: trick the LEFT OUTER JOIN operator...
    set serveroutput on timing on autotrace on
    SELECT T1.SPECIES    as City,
           T2.ADMIN_NAME as Municipality,
           T2.GEOM       as geom
      FROM GUTDATA           T1
           LEFT OUTER JOIN
           AUSTRALIAN_STATES T2
           ON (t2.admin_name = to_char(t1.ID) OR
               SDO_ANYINTERACT(T2.GEOM, SDO_GEOM.SDO_BUFFER(T1.GEOM,10000,0.5,'UNIT=M')) = 'TRUE');
    762 rows selected
    Elapsed: 00:00:50.273
    Plan hash value: 158854308
    | Id  | Operation           | Name              | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT    |                   |   762 | 92964 |  2294   (1)| 00:00:28 |
    |   1 |  NESTED LOOPS OUTER |                   |   762 | 92964 |  2294   (1)| 00:00:28 |
    |   2 |   TABLE ACCESS FULL | GUTDATA           |   762 | 49530 |     5   (0)| 00:00:01 |
    |   3 |   VIEW              |                   |     1 |    57 |     3   (0)| 00:00:01 |
    |*  4 |    TABLE ACCESS FULL| AUSTRALIAN_STATES |     1 |   115 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       4 - filter("T2"."ADMIN_NAME"=TO_CHAR("T1"."ID") OR
                  "MDSYS"."SDO_ANYINTERACT"("T2"."GEOM","SDO_GEOM"."SDO_BUFFER"("T1"."GEOM",10000,0.5,'UNIT=M'))='TRUE')
       Statistics
                   7  user calls
                   0  physical read total bytes
                   0  physical write total bytes
                   0  spare statistic 3
                   0  commit cleanout failures: cannot pin
                   0  TBS Extension: bytes extended
                   0  total number of times SMON posted
                   0  SMON posted for undo segment recovery
                   0  SMON posted for dropping temp segment
                   0  segment prealloc tasksTry these combinations to see what works for you.
    Interestingly, for me, the following returns absolutely nothing.
    SELECT T1.SPECIES    as City,
           T2.ADMIN_NAME as Municipality
      FROM GUTDATA           T1
           LEFT OUTER JOIN
           AUSTRALIAN_STATES T2
           ON (SDO_ANYINTERACT(T2.GEOM, SDO_GEOM.SDO_BUFFER(T1.GEOM,10000,0.5,'UNIT=M')) = 'TRUE')
    MINUS
    SELECT T1.SPECIES    as City,
           T2.ADMIN_NAME as Municipality
      FROM GUTDATA           T1
           LEFT OUTER JOIN
           AUSTRALIAN_STATES T2
           ON (t2.admin_name =  to_char(t1.ID) OR
               SDO_ANYINTERACT(T2.GEOM, SDO_GEOM.SDO_BUFFER(T1.GEOM,10000,0.5,'UNIT=M')) = 'TRUE');(I leave it to you to see if you can see why as the LEFT OUTER JOIN seems to be working correctly for me but I am not going to dedicate time to detailed checking of results.)
    Note all tests performed on Oracle 11g R2 (11.2.0.1.0)
    If you get the answer you want: mark the post as answered to assign points.
    regards
    Simon

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

  • 3 tables with left joins - bug?

    Hello,
    i am making query where i encounter problem with left join in oracle. I am using oracle 10g and i prepare simple test case.
    he is testing tables and datas - really simple i think:
    drop table t1;
    drop table t2;
    drop table t3;
    create table t1 (a number not null);
    create table t2 (a number, b number);
    create table t3 (b number);
    insert into t3 values (1);
    insert into t3 values (2);
    insert into t3 values (3);
    insert into t1 (a) values (1);
    insert into t2 (a,b) values (1,1);
    insert into t1 (a) values (2);
    insert into t2 (a,b) values (2, null);
    insert into t1 (a) values (3);
    insert into t1 (a) values (4);
    insert into t2 (a,b) values (4,1);
    insert into t1 (a) values (5);
    insert into t2 (a,b) values (5,3);
    and now query with left joins:
    select
    t1.a
    , t2.a, t2.b
    , t3.b
    from
    t1, t2, t3
    where
    t1.a = t2.a (+)
    and t2.b = t3.b (+)
    and t3.b is null
    order by t1.a
    i get two rows as result:
    A A_1 B B_1
    2 2 null null      
    3 null null null                
    i expect these rows but when i change my query - i dont want get back t3.b column:
    select
    t1.a
    , t2.a, t2.b
    /* , t3.b*/
    from
    t1, t2, t3
    where
    t1.a = t2.a (+)
    and t2.b = t3.b (+)
    and t3.b is null
    order by t1.a
    i get only one row
    A A_1 B
    2 2 null
    My question is simple how can i only by changing columns getting back change number of returned rows? I must say i dont expect these result i expect two rows again.
    Thanks for help.

    BluShadow wrote:
    I think I know what you are getting at.
    By testing for null on t3.b when you aren't selecting the column, you are enforcing oracle to perform the join through t2 onto t1, but Oracle can't join because t2 has no matching row (although it's outer joined to t1) and therefore, for the one row it can't actually determine if t3.b is null or not, so that row can't match the conditions in a "true" sense and be displayed. If you select the column then oracle can test its nullness ok. (Perhaps this is a bug, I don't know, it's just how I know it works)If you get different results only by changing the projection part of the query this is a bug and nothing else. I can't reproduce using Oracle 10g XE, I get in both cases shown the expected two rows.
    What versions are you using to test this?
    SQL>
    SQL> select * from v$version
      2  where rownum <= 1;
    BANNER
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    SQL>
    SQL> drop table t1 purge;
    Table dropped.
    SQL> drop table t2 purge;
    Table dropped.
    SQL> drop table t3 purge;
    Table dropped.
    SQL>
    SQL> create table t1 (a number not null);
    Table created.
    SQL> create table t2 (a number, b number);
    Table created.
    SQL> create table t3 (b number);
    Table created.
    SQL>
    SQL> insert into t3 values (1);
    1 row created.
    SQL> insert into t3 values (2);
    1 row created.
    SQL> insert into t3 values (3);
    1 row created.
    SQL>
    SQL> insert into t1 (a) values (1);
    1 row created.
    SQL> insert into t2 (a,b) values (1,1);
    1 row created.
    SQL>
    SQL> insert into t1 (a) values (2);
    1 row created.
    SQL> insert into t2 (a,b) values (2, null);
    1 row created.
    SQL>
    SQL> insert into t1 (a) values (3);
    1 row created.
    SQL>
    SQL> insert into t1 (a) values (4);
    1 row created.
    SQL> insert into t2 (a,b) values (4,1);
    1 row created.
    SQL>
    SQL> insert into t1 (a) values (5);
    1 row created.
    SQL> insert into t2 (a,b) values (5,3);
    1 row created.
    SQL>
    SQL> commit;
    Commit complete.
    SQL>
    SQL> select t1.a
      2       , t2.a, t2.b
      3       , t3.b
      4  from
      5         t1 left outer join t2 on (t1.a = t2.a)
      6            left outer join t3 on (t2.b = t3.b)
      7  where t3.b is null
      8  order by t1.a;
             A          A          B          B
             2          2
             3
    SQL>
    SQL> select t1.a
      2       , t2.a, t2.b
      3  --     , t3.b
      4  from
      5         t1 left outer join t2 on (t1.a = t2.a)
      6            left outer join t3 on (t2.b = t3.b)
      7  where t3.b is null
      8  order by t1.a;
             A          A          B
             2          2
             3
    SQL>Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

Maybe you are looking for

  • Cannot add Connected Service in asp.web form project in vs 2012

    Hi All, I m trying to add  Connected Service in asp.web form project in vs 2012 as shown below image. But my VS 2012 doesn't has that option as shown second image. Any help please. First image Second image  d.n weerasinghe

  • Need help compiling an EJB with Apache Tomcat 5.5

    Hi everyone, I need some help. I�m writing an EJB that has to run on Apache Tomcat 5.5. I�m importing the javax.ejb.* library, but Eclipse can�t find the JAR it needs. Where can I find this JAR? Do I have to download or what? Thanks a lot.

  • Non modifiable field in Purchase Requisition

    Hi, I would like to prevent users to change the material designation while creating and modifying PR, but only for few material types (all stocked material : eg ERSA materials). Only Account assigned articles should be modifiable. Item category in th

  • Design View question

    Good evening, I'm working on a site using a Dreamweaver template and for some reason my "Design View" shows up only like you'll see in the top image on this page: http://community.middlebury.edu/~nmeiers/question.htm I want the pages to appear like t

  • ACE 4710 Issue

    Dears, I have Cisco 4710 configured, but my issue that I can't ping the Virtual IP. Attached the configuration of the ACE4710. Appreciate you support, Regards.