Left Outer Join not working in Infoset.

Hello Friends,
I have two ODSes , one for planned data (zplan) and other is billing z ods (zsd_o03).
now the situation is such that in my planned ODS  for one sold to party .
SOLD TO        MATERRIAL CALMONT     PLANNED QUANTIY
14315            100                06.2007           54
14315            200                06.2007           20
14315            300                06.2007           30
14315            400                06.2007           10
But in my Billing ODS iam having for Sold to 14315
SOLD TO        MATERRIAL CALMONT     ACTUAL QUANTIY
14315           100           06.2007                  20
14315           200           06.2007                  30
And my Bex ouput should be like
SOLD TO        MATERIAL CALMONT        planned             ACTUAL QUANTIY
14315            100                06.2007           54                                 20
14315            200                06.2007           20                                30
14315            300                06.2007           30                                  0
14315            400                06.2007           10                                0
So for this i made one Infoset and these ODses are linked by Sold_to , Materail,
Calmonth.
First i tried using Inner joing option , but the bottom two lines were not ciming , so used left outer join , and activated and recreated the query but still its showiong me the output same as inner join .. i.e
14315            100                06.2007           54                                 20
14315            200                06.2007           20                                30
So i checked by writing a ABAP code in Se38 , but there its showing me the correct result ..
So please anybody help me out because iam thinking that infoset is the right way to do this kind of reporting , or esle shall i make one ODS and populate it through this ABAP code..
Thanks in advance.

Hi , can anybody help me in this regard..
Thanks ..

Similar Messages

  • Left Outer Join Not working in BI 7.0 Infoset

    Hi All,
    I am working on BI 7.0. I have to create a report where I have to display the Target values from a target DSO against the transactional data (Operational data).
    I have a DSO where for a “subteam” value target has been set up on different KPIs.
    In the Info Cube, I have transactional data on daily basis per “subteam”. I have to show the actual and target values.
    I have created an Info Set using Target DSO and Daily operational cube, so that I should able to compare the target and actual values of KPIs, for all the “subteam” values (From DSO, irrespective of whether the data is available in cube for those sub team).
    I have used Outer Left Join in the Info set (DSO on left side), but I am unable to see the desired results. It is working just like an inner join.
    Any Idea why the Outer Left Join is not working? The DSO has only one fey field called “subteam” on which I have set outer left join.
    Regards,
    Amit

    Hi,
    did you solve your problem? because I have the same issue right now: the left outer join doesn't seem to do its job.
    Let me know if you have found a solution, it would be appreciated.
    have a nice day,
    Dominic

  • LEFT OUTER JOIN not working as expected

    I'm testing a query from the portal. I've got two inputs:
    products
    {"ProductKey":1,"ProductAlternateKey":"abc","Color":"Red"},
    {"ProductKey":2,"ProductAlternateKey":"def","Color":"Blue"},
    {"ProductKey":3,"ProductAlternateKey":"ghi","Color":"Blue"}
    And temperatures:
    {"DeviceId":1,"Temperature":99},
    {"DeviceId":2,"Temperature":90},
    {"DeviceId":2,"Temperature":99},
    {"DeviceId":3,"Temperature":50},
    {"DeviceId":4,"Temperature":32}
    When I test a query with an (inner) join, I get two rows, one for Red and one for Blue as expected. However, when I change to a LEFT OUTER JOIN, I would expect to get three rows... one for Red, one for Blue, and one for NULL color. However, I only get one
    row with a NULL color. Here's the query. Is this a bug or am I misunderstanding?
    SELECT DateAdd(second,-5,System.TimeStamp) as WinStartTime
    , system.TimeStamp as WinEndTime
    , b.Color
    , Avg(r.Temperature) as AvgTemperature
    , Count(*) as EventCount
    FROM temperatures r
    LEFT OUTER JOIN products b ON r.DeviceId = b.ProductKey and DATEDIFF(hour,r,b) BETWEEN -6 AND 6
    GROUP BY TumblingWindow(second, 5), b.Color
    (Please excuse the contrived example, the lack of timestamps, and the 12 hour window... just testing.)
    http://artisconsulting.com/Blogs/GregGalloway

    Hi Greg,
    Thank you for raising this issue.
    We have deployed a fix today that corrects LEFT OUTER JOIN behavior on the in-browser query testing experience.
    Can you please confirm that the above query and input sources work for you?
    Thanks!
    Ziv.

  • Dynamic From statement in select query and/or outer join not working

    Dear Experts, I have a select query where the select columns are dynamic, the where condition is also dynamic. It is of the below format:
    Select (dynamic columns) INTO <wa>
    FROM a inner join b on af1 = bf1
    inner join c on af2 = cf2......
    WHERE (dynamic conditios)
    ORDER BY ( dynamic sort condition).
    Now I have to include some tables (dynamically depending on the user input) in the inner join statement which will give description for the selected fields. And these database tables may or may no be empty. So in this case, my select query will not return any data if these tables are empty. And I dont want that.
    I tried using outer join for the extra tables but it gave me a runtime error. I also tried forming the inner join statement dynamically but it was not supporting.
    Kindly give me pointers.
    Thanks

    Hey thanks for the reply, but the problem is not solved.
    I am already using  ( fileds, value) like table in my where condition and the select statement was working properly.
    the problem is that now I have to include some tables in the join statement which can be empty and so i want to use Outer join.
    But I am getting a runtime error as below:
    Error analysis
        An exception occurred that is explained in detail below.
        The exception, which is assigned to class 'CX_SY_DYNAMIC_OSQL_SYNTAX', was not
         caught in
        procedure "ZATSCSNG_RFC_READ_TABLE" "(FUNCTION)", nor was it propagated by a
         RAISING clause.
        Since the caller of the procedure could not have anticipated that the
        exception would occur, the current program is terminated.
        The reason for the exception is:
        The running ABAP program wanted to execute a SELECT statement whose
        WHERE condition was (partly) specified dynamically. The part that is
        specified in an internal table at runtime is compared to a field of the
        right table of an LEFT OUTER JOIN. Such comparisons are not supported by
         all database systems and are therefore not allowed.

  • Outer join not working when filters are applied from Prompts

    Hi,
    Without values being selected from the dashboard prompts, my outer join is working fine with all the rows and all the columns showing up( as per requirement). But as soon as I select values in the prompts, only certain rows and columns show up.
    BTW, I have 2 prompts Year and Quarter. I put Year is Prompted or is null in the criteria. It works. BUT as soon as I also put in quarter numbers, it does not work.
    Is there a workaround for this?
    Thanks,
    Dan
    Edited by: Danny on Apr 26, 2013 12:10 PM

    I just experimented by adding is null to not only the year and quarter but to the row and column too and it worked!
    Thanks,
    Dan

  • Merging two complemental result sets... or OUTER JOINs not working?

    Dear experts!
    Again I have a very difficult problem for which I ask Your help, but this time I am better prepared than last time and can deliver sample data of my (hopefully not too much) simplified example:
    create table Subjects(
    pk_id          number          not null primary key,
    title          varchar2(128)
    create table People(
    pk_id          number          not null primary key,
    name          varchar2(128)
    create table Results(
    pk_id          number          not null primary key,
    fk_subjects_id     number,
    fk_people_id     number,
    result          number
    insert into Subjects(pk_id, title) values (1, 'Choosing a recipe')
    insert into Subjects(pk_id, title) values (2, 'Shopping ingredients')
    insert into Subjects(pk_id, title) values (3, 'Preparations')
    insert into Subjects(pk_id, title) values (4, 'Cooking for beginners')
    insert into Subjects(pk_id, title) values (5, 'Eating for pros')
    insert into Subjects(pk_id, title) values (6, 'Dishwashing for everyone')
    insert into Subjects(pk_id, title) values (7, 'Digesting for experts')
    insert into Subjects(pk_id, title) values (8, 'Becoming hungry again...')
    insert into Subjects(pk_id, title) values (9, 'Redo from start')
    insert into People(pk_id, name) values (1, 'Hank')
    insert into People(pk_id, name) values (2, 'Cloe')
    insert into People(pk_id, name) values (3, 'Mary')
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (1, 1, 1, 2)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (2, 2, 1, 4)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (3, 3, 1, 3)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (4, 9, 1, 5)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (5, 1, 2, 4)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (6, 2, 2, 1)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (7, 3, 2, 5)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (8, 4, 2, 2)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (9, 5, 2, 3)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (10, 6, 2, 2)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (11, 7, 2, 1)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (12, 4, 3, 3)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (13, 5, 3, 5)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (14, 7, 3, 1)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (15, 8, 3, 5)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (16, 9, 3, 1)
    Please imagine this as an university for amateur cooks. Now I want to present them their performance record/"scorecard", for every student, only with her or his marks. On this performance record there should be a list of all 9 subjects possible to pass, and where students got a result, that result should be filled in. I thought that should be possible to achieve with something like this:
    SELECT PEOPLE.NAME, SUBJECTS.TITLE, RESULTS.RESULT FROM RESULTS
    JOIN PEOPLE ON PEOPLE.PK_ID = RESULTS.FK_PEOPLE_ID
    JOIN SUBJECTS ON SUBJECTS.PK_ID = RESULTS.FK_SUBJECTS_ID
    WHERE RESULTS.FK_PEOPLE_ID = 2
    But also using (LEFT|RIGHT|FULL) OUTER JOINs here does not help me to get what I want, I always only get
    NAME TITLE RESULT
    Cloe Choosing a recipe 4
    Cloe Shopping ingredients 1
    Cloe Preparations 5
    Cloe Cooking for beginners 2
    Cloe Eating for pros 3
    Cloe Dishwashing for everyone 2
    Cloe Digesting for experts 1
    But I want:
    NAME TITLE RESULT
    Cloe Choosing a recipe 4
    Cloe Shopping ingredients 1
    Cloe Preparations 5
    Cloe Cooking for beginners 2
    Cloe Eating for pros 3
    Cloe Dishwashing for everyone 2
    Cloe Digesting for experts 1
    Cloe Becoming hungry again...
    Cloe Redo from start
    Without having to fill in empty rows for all students which did not take all exams yet.
    Is it possible? If so, how?
    Thank You very much in advance and Happy Easter to everyone! :-)
    With kind regards,
    Chriss
    Edited by: user9355711 on 01.04.2010 07:01
    Edited by: user9355711 on 01.04.2010 07:28
    Edited by: user9355711 on 01.04.2010 07:29

    Also;
    var n number
    exec :n := 2;
    PL/SQL procedure successfully completed
    n
    2
    select ppl.name, sub.title, res.result
      from subjects sub, people ppl, results res
    where sub.pk_id = res.fk_subjects_id(+)
       and ppl.pk_id = :n
       and res.fk_people_id(+) = :n
    order by sub.title;
    NAME       TITLE                         RESULT
    Cloe       Becoming hungry again... 
    Cloe       Choosing a recipe                  4
    Cloe       Cooking for beginners              2
    Cloe       Digesting for experts              1
    Cloe       Dishwashing for everyone           2
    Cloe       Eating for pros                    3
    Cloe       Preparations                       5
    Cloe       Redo from start          
    Cloe       Shopping ingredients               1

  • Outer join not working

    Hello everybody,
    I have a folder based on materialized view (Detailed folder). There is another folder which is based on a table (master folder). i have created a jooin and select option as "outer join on master folder". The join is not working properly. Am i doing asomething wrong. Discoverer version is 10.1.2 and database version is 10.2.0.3. i have been creating outer joins among folders based on tables but i am not sure about whats wrong this time??? materalized view defination is as follows:
    CREATE MATERIALIZED VIEW MW
    BUILD IMMEDIATE
    REFRESH FORCE
    START WITH SYSDATE
    NEXT TRUNC(SYSDATE+1)+1/4
    WITH PRIMARY KEY
    AS
    SELECT * FROM VIEW
    Thanx for your help
    Regards,
    Najeeb

    So, let me see if I got this...
    You have a table and a materialized view. There is a join between the two, where the table is the master, and the MV is the detail. The join is set to be an outer join on master. Ultimately, you want to see the values in the MV where the join condition is NULL.
    What boggles me is that you say the query runs fine in the database, but not in Disco. This could mean that there is a condition in the BA or in the worksheet. But, if that were the case, the condition should show up in the SQL generated by Disco.
    It looks like the where clause is the problem. NULL is never equal to anything, so when APPROVEDBY is null, the where clause should fail and no data returned. This explains Disco's behavior, but not SQL's.
    Something to try: Create a calculation in the materialized view folder of the business area like:
    NVL(APPROVEDBY, -1)
    I am assuming that all of your IDs are positive. Then modify the join to use the calculated column. This should convert the NULLS to values, and the report should work.

  • OJ syntax for multi-table left outer join with MS Oracle Driver

    I have a multi-table left outer join that works fine in SQL Server ODBC Driver, Oracle ODBC driver 8.01.07.00, but not with Microsoft ODBC Driver for Oracle 2.573.7326.0
    SELECT * from { oj A LEFT OUTER JOIN B ON A.col1 = B.col1 LEFT OUTER JOIN C ON A.col1 = C.col1 }
    I noticed someone had a similar problem (the proposed solution doesn't work):
    http://www.justpbinfo.com/listarchive/msg02874.html
    Does anyone know how to get this working with the Microsoft ODBC Driver for Oracle? Or does it just not work?

    The Microsoft ODBC Driver for Oracle 2.573.7326.0 does perform the same 'fix up' with {oj} in Oracle 8i. The problem is that it doesn't work when joining more than two tables:
    This works:
    SELECT * from { oj A LEFT OUTER JOIN B ON A.col1 = B.col1}
    This doesn't work:
    SELECT * from { oj A LEFT OUTER JOIN B ON A.col1 = B.col1 LEFT OUTER JOIN C ON B.col1 = C.col1 }
    (The second query will work with the Oracle Oracle ODBC driver, with a bit of tweaking. But I haven't found a way to get it to work with the Microsoft ODBC Driver for Oracle 2.573.7326.0. My suspicion is that it just doesn't work.)
    Gavin

  • Left outer join on Fact and dimension table.

    Hi all, I have a fact F with account number and few measures as columns.
    I also have a dimension D with account number, account name columns.
    Few account numbers from Fact doesnt exist in Dimension D , but they need to show up in the report though.
    How do I left join Fact and Dimension D in RPD?
    I have this report where I need to show Account Number, Account name, measures.
    If D doesnt have certain account numbers, I need to convert that account number from F as string and show it in the report in account name column.
    Can you pls help.

    Ok. I tried this:
    Driving table : Fact, Left outer join -- didnt work.
    Driving table: Dimension D left outer join -- didnt work either
    In either the case, I see physical query as D left outer Join on Fact F. and omitting the rows.
    And then I tried this -
    Driving table: Fact, RIght outer join.
    Now, this is giving me error:
    Sybase][ODBC Driver]Internal Error. [nQSError: 16001] ODBC error state: 00000 code: 30128 message: [Sybase][ODBC Driver]Data overflow. Increase specified column size or buffer size. [nQSError: 16011] ODBC error occurred while executing SQLExtendedFetch to retrieve the results of a SQL statement. (HY000)
    I checked all columns, everything matched with database table type and size.
    I am pulling Fact.account number, Dimension.account name, Fact.Measures. I am seeing this error each time I pull Fact.Account number.

  • Left Outer Join & IS NULL Not Working

    In a Data Flow Query element I am using a Left Outer Join to correlate two tables. In order to eliminate rows in which the Left Outer Join found a match with the Right table I am using IS NULL in the Where clause. Unfortunately IS NULL doesn't seem to return true when the NULL is caused by a lack of a match on a Left Outer Join. Has anybody been able to work around this?

    Use not is NULL in next query after the join.
    A source 1 ---
                           C (join query) ----- D (filter condition IS NULL)
    B source 2 ---

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

  • BI 7.0 Left outer join in Infoset

    Hi Everybody,
    I am using BI 7.0 and have two cubes in my Infoset.
    How do we set left outer join option in Infoset.
    Thanks
    Shilpa

    Look at  <a href="http://help.sap.com/saphelp_nw2004s/helpdata/EN/05/7ce2416149c717e10000000a155106/frameset.htm">this</a> page. Note the text: <i>For performance reasons, you cannot define an InfoCube as the right operand of a left outer join.</i> Hope this helps...

  • 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

  • Difference between merge-Not matched and left outer join

    Why should Merge-Not Matched be used instead of left outer join? I believe both will enable comparison of 2 tables. So what is the difference. Please advice.
    mayooran99

    MERGE is way to encapsulate all conditions within single statement
    The equivalent implementation using join would require three different statements 
    1 UPDATE using INNER JOIN
    1 INSERT using LEFT JOIN
    and 1 DELETE using LEFT JOIN in reverse order
    Both approaches work fine
    so all that you need to do is left join operation to find difference you can use either
    But MERGE has one additional advantage in case you need to get output from MERGE and use it for further manipulation like further insert to child table
    I've explained it here
    http://visakhm.blogspot.in/2014/09/t-sql-tips-multifaceted-merge-statement.html
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How to change to a left outer join an Infoset that is already created?

    Hi! I need HELP please!!!
    I created a data model based on an Infoset, but at the time to report on WEBI, there is a field that is recognized as a text instead of a date. I've been trying to modify everything i think of but nothing worked!!!!!! So now i want to change my infoset to a left outer join but i can't find where.
    Could anyone help me, please!?

    Hi,
    This is very simple. Just right click on the right operand, you will see the option.

Maybe you are looking for