Help required in a full outer join

In my view, the query below can be changed at the full outer join. But, I was not able to do.
I need your help to change to the full outer join. My current request is
SELECT CLAIMNO,'1' INDX FROM D_CLAIM@CMS2PROD
WHERE clntsys=76500 and facility=76501 and filecreatedt='18-feb-2011' and fileupdatedt is null
MINUS
SELECT CLAIMNO,'1' FROM D_CLAIM
WHERE clntsys=76500 and facility=76501 and filecreatedt='18-feb-2011' and fileupdatedt is null
UNION
SELECT CLAIMNO,'2' FROM D_CLAIM
WHERE clntsys=76500 and facility=76501 and filecreatedt='18-feb-2011' and fileupdatedt is null
MINUS
SELECT CLAIMNO,'2' FROM D_CLAIM@cms2prod
WHERE clntsys=76500 and facility=76501 and filecreatedt='18-feb-2011' and fileupdatedt is null

Something like:

select nvl(p.claimno,s.claimno) claimno,
       nvl2(p.claimno,'PROD','STAGING') the_source,
       :the_clntsys clntsys,
       :the_facility facility
  from (select claimno
          from d_claim
         where clntsys = :the_clntsys
           and facility = :the_facility
       ) p
       full outer join
       (select claimno
          from d_claim@cms2prod        /* never tried with remote */
         where clntsys = :the_clntsys
           and facility = :the_facility
       ) s
       on p.claimno = s.claimno
 where p.claimno is null
    or s.claimno is null

Concerning

Etbin

Tags: Database

Similar Questions

  • HELP SQL (auto / full outer join with date corresponding)

    I'm having a hard time get this query nailed... hoping someone can help me sorted.

    create table tab1 (identification number,

    date of eff_date,

    Code1 varchar2 (2),

    Code2 varchar2 (2)

    )

    /

    insert into tab1 values (2, to_date('2015-01-14','YYYY-MM-DD'), 'DAT', 'AS');

    insert into tab1 values (2, to_date('2015-03-19','YYYY-MM-DD'), 'DAT', 'AS');

    insert into tab1 values (2, to_date('2015-08-28','YYYY-MM-DD'), 'DAT', 'AS');

    insert into tab1 values (2, to_date('2015-11-12','YYYY-MM-DD'), 'DAT', 'AS');

    insert into tab1 values (2, to_date('2015-01-03','YYYY-MM-DD'), "DAT", "AE");

    insert into tab1 values (2, to_date('2015-03-14','YYYY-MM-DD'), "DAT", "AE");

    insert into tab1 values (2, to_date('2015-04-18','YYYY-MM-DD'), "DAT", "AE");

    insert into tab1 values (2, to_date('2015-09-14','YYYY-MM-DD'), "DAT", "AE");

    insert into tab1 values (2, to_date('2015-01-14','YYYY-MM-DD'), "DAT", "BS");

    insert into tab1 values (2, to_date('2015-02-14','YYYY-MM-DD'), "DAT", "BS");

    insert into tab1 values (2, to_date('2015-03-14','YYYY-MM-DD'), "DAT", "BS");

    insert into tab1 values (2, to_date('2015-05-14','YYYY-MM-DD'), 'DAT', 'BE');

    insert into tab1 values (3, to_date('2015-09-16','YYYY-MM-DD'), 'DAT', 'AS');

    insert into tab1 values (3, to_date('2015-04-16','YYYY-MM-DD'), "DAT", "AE");

    tab1

    ID, date, code 1, code2

    2. DID DAT 2015-01-14

    2. DID DAT 2015-03-19

    2. DID DAT 2015-08-28

    2. DID DAT 2015-11-12

    2 AE DAT 2015-01-03

    2 AE DAT 2015-03-14

    2 AE DAT 2015-04-18

    2 AE DAT 2015-09-14

    2 BS DAT 2015-01-14

    2 BS DAT 2015-02-14

    2 BS DAT 2015-03-14

    BE DAT 2 2015-05-14

    3. DID DAT 2015-09-16

    3 AE DAT 2015-04-16

    What I need to do...

    1 auto join to match EI for each partition ID

    2. THAT the date must be less than or equal to the date of the AE and when there is more then a line corresponding to this criterion has chosen the date of closest EI of the date of the ACE.

    3. it must be a full outer join because I want to show all lines, even if it is not a match.  There is a beginning, but not record end end gold but no record of departure

    4. If there is an AE line for many AS lines (the SA date is less then equals the date of EI) then join this AE line to all 3 rows of ACE

    5. the same rules for BS and BE.

    result should look like this.

    ID, date, code 1, id_1 code2, date_1, code1_1, code2_1

    2 2015-01-14 DAT AS 2 AE DAT 2015-03-14

    2 2015-03-19 DAT AS 2 AE DAT 2015-04-18

    2 2015-08-28 DAT AS 2 AE DAT 2015-09-14

    2 2015-11-12 DAT DID ZERO ZERO ZERO ZERO

    NO NO NO NO 2 AE DAT 2015-01-03

    2015-01-2 14 DAT BS 2 BE DAT 2015-05-14

    2015-02-2 14 DAT BS 2 BE DAT 2015-05-14

    2015 03-2 14 DAT BS 2 BE DAT 2015-05-14

    3 2015-09-16 DAT DID ZERO ZERO ZERO ZERO

    NO NO NO NO 3 AE DAT 2015-04-16

    My attempt was somewhat along these lines (dealing only with SA / combos AE) but it does not manage the many scenarios one (req 4).

    Select a.*, b.* from

    (select row_number () on the rn (partition by a.id order a.eff_date), a.*)

    of tab1 where a.code2 = 'AS') a

    full outer join

    (select row_number () on the rn (b.eff_date order by b.id partition), b.*)

    tab1 b where b.code2 = 'Æ') b

    on a.id = b.id

    and a.rn = b.rn

    and a.eff_date < = b.eff_date

    Hello

    owbdev99 wrote:

    I'm having a hard time get this query nailed... hoping someone can help me sorted.

    create table tab1 (identification number,

    date of eff_date,

    Code1 varchar2 (2),

    Code2 varchar2 (2)

    )

    /

    insert into tab1 values (2, to_date('2015-01-14','YYYY-MM-DD'), 'DAT', 'AS');

    ...

    Thanks for posting the CREATE TABLE and INSERT.  I know it can be a lot of trouble.  You want to get answers that work, not you?  Make sure that the statements you post too much work.  Test (and, if necessary, attach) your statements before committing.  You said code1 be VARCHAR2, but all the instructions insertion have values of 3 characters for code1.

    You are on the right track, with an analytical function, but ROW_NUMBER solves this problem.  1 "THAT line" could correspond to the 1st, 2nd, 3rd or any other line 'AE' and vice versa.  Try to use the analytical MIN function instead or ROW_NUMBER, like this:

    WITH got_next_e_date AS

    (

    SELECT id, eff_date, code1, code2

    MIN (CASE

    WHEN SUBSTR (code2, 2) = 'E '.

    THEN eff_date

    END

    ) OVER (PARTITION BY ID.

    , SUBSTR (code2, 1, 1)

    ORDER BY eff_date DESC

    ) AS next_e_date

    OF tab1

    )

    s AS

    (

    SELECT *.

    OF got_next_e_date

    "WHERE SUBSTR (code2, 2) s ="

    )

    e

    (

    SELECT *.

    OF got_next_e_date

    WHERE SUBSTR (code2, 2) = 'E '.

    )

    SELECT s.id

    s.eff_date

    s.code1

    s.code2

    e.id AS id_1

    e.eff_date AS eff_date_1

    e.code1 AS code1_1

    e.code2 AS code2_1

    S

    FULL OUTER JOIN e ON s.id = e.id

    AND s.next_e_date = e.eff_date

    AND SUBSTR (s.code2, 1, 1) = SUBSTR (e.code2, 1, 1)

    ORDER OF NVL (s.id, e.id)

    , NVL (SUBSTR (s.code2, 1, 1)

    , SUBSTR (e.code2, 1, 1)

    )

    s.eff_date

    ;

    Out (as you asked):

    ID EFF_DATE CODE1, CODE2 ID_1 EFF_DATE_1 CODE1_1 CODE2_1

    --- ---------- ----- ----- ----- ---------- ------- -------

    2 2015-01-14 DAT AS 2 AE DAT 2015-03-14

    2 2015-03-19 DAT AS 2 AE DAT 2015-04-18

    2 2015-08-28 DAT AS 2 AE DAT 2015-09-14

    2. DID DAT 2015-11-12

    2 AE DAT 2015-01-03

    2015-01-2 14 DAT BS 2 BE DAT 2015-05-14

    2015-02-2 14 DAT BS 2 BE DAT 2015-05-14

    2015 03-2 14 DAT BS 2 BE DAT 2015-05-14

    3. DID DAT 2015-09-16

    3 AE DAT 2015-04-16

    I guess code2 is always 2 characters, and the 2nd character is always ' or 'E '.

    I assume that the combination [id, eff_date, code2] is unique.

    If these assumptions are wrong, you need a few minor changes, but nothing big.

  • Help with sql FULL OUTER JOIN

    Hi all
    I need assistance with SQL FULL OUTER JOIN.

    How to write with FULL OUTER JOIN, the query.
    I tried like


    I have 3 different queries.

    Query q: SELECT emp_id LN.emp_id.
    Sum (LN_amount) loan_amt
    MY_LON_TAB LN
    WHERE LN_amount > 20000
    LN.emp_id GROUP;



    Query b: SELECT PLN. EMP_ID emp_id,
    Sum (PLAN_AMOUNT) plan_amt
    FROM PLN MY_PLAN_TAB
    where PLAN_AMOUNT <>0
    GROUP BY PLN. EMP_ID;


    Query C:

    SELECT FLX. EMP_ID emp_id,
    SUM (PRORATE_AMOUNT) PRORATE_AMT
    OF MY_FLX_TAB FLX
    WHERE PRORATE_AMOUNT <>0
    FLX GROUP. EMP_ID;


    Suppose that the different subquery above 3 a, b, c respectively. each subquery with emp_id and respective amount.

    like a.emp_id, a.loan_amt
    b.emp_id, b.plan_amt
    c.emp_id, c.prorate_amt

    I show all the empid with their amount respective.
    schenario: If an account made, but not vice-versa b
    and B have record, but not vice versa c
    and a credit record but not vice versa c

    first: I have external is associated with the A and B
    Second: join external then complete the total outcome of (a & b) with c
    but empid c just as empty.


    My output is:

    emp_id a.loan_amt, b.plan_amt c.prorate_amt
    101 5000 null null
    102 4500 null 2000
    103 6700 null null


    How to solve the foregoing to the ANSI (FULL OUTER JOIN) method.
    Please suggest me.

    Thanks in advance...
    PKM

    Hello

    It is very difficult for anyone to say what you're doing wrong if they do not know what you are doing. Post your code FULL OUTER JOIN.
    My best guess is:

    WITH     a     AS
    (
         SELECT     ...      -- What you posted as query a
    )
    ,     b     AS
    (
         SELECT     ...      -- What you posted as query b
    )
    ,     c     AS
    (
         SELECT     ...      -- What you posted as query c
    )
    SELECT     COALESCE ( a.emp_id
               , b.emp_id
               , c.emp_id
               )     AS emp_id
    ,     ...     -- whatever other columns you want
    FROM          a
    FULL OUTER JOIN     b  ON     b.emp_id =            a.emp_id
    FULL OUTER JOIN     c  ON     c.emp_id = COALESCE (a.emp_id, b.emp_id)
    ;
    

    I hope that answers your question.
    If not, post a small example (CREATE TABLE and INSERT statements) data for all tables and the results expected from these data (if not what you have already posted).

  • [8i] need help with full outer join combined with a cross join...

    I can't understand how to combine a full outer join with a different type of join... is it possible?

    Here are some create table and insert for examples of database:
    CREATE TABLE     my_tab1
    (     record_id     NUMBER     NOT NULL     
    ,     workstation     VARCHAR2(4)
    ,     my_value     NUMBER
         CONSTRAINT my_tab1_pk PRIMARY KEY (record_id)
    );
    
    INSERT INTO     my_tab1
    VALUES(1,'ABCD',10);
    INSERT INTO     my_tab1
    VALUES(2,'ABCD',15);
    INSERT INTO     my_tab1
    VALUES(3,'ABCD',5);
    INSERT INTO     my_tab1
    VALUES(4,'A123',5);
    INSERT INTO     my_tab1
    VALUES(5,'A123',10);
    INSERT INTO     my_tab1
    VALUES(6,'A123',20);
    INSERT INTO     my_tab1
    VALUES(7,'????',5);
    
    
    CREATE TABLE     my_tab2
    (     workstation     VARCHAR2(4)
    ,     wkstn_name     VARCHAR2(20)
         CONSTRAINT my_tab2_pk PRIMARY KEY (workstation)
    );
    
    INSERT INTO     my_tab2
    VALUES('ABCD','WKSTN 1');
    INSERT INTO     my_tab2
    VALUES('A123','WKSTN 2');
    INSERT INTO     my_tab2
    VALUES('B456','WKSTN 3');
    
    CREATE TABLE     my_tab3
    (     my_nbr1     NUMBER
    ,     my_nbr2     NUMBER
    );
    
    INSERT INTO     my_tab3
    VALUES(1,2);
    INSERT INTO     my_tab3
    VALUES(2,3);
    INSERT INTO     my_tab3
    VALUES(3,4);
    And, the results that I want to get:
    workstation     sum(my_value)     wkstn_name     my_nbr1     my_nbr2
    ---------------------------------------------------------------
    ABCD          30          WKSTN 1          1     2
    ABCD          30          WKSTN 1          2     3
    ABCD          30          WKSTN 1          3     4
    A123          35          WKSTN 2          1     2
    A123          35          WKSTN 2          2     3
    A123          35          WKSTN 2          3     4
    B456          0          WKSTN 3          1     2
    B456          0          WKSTN 3          2     3
    B456          0          WKSTN 3          3     4
    ????          5          NULL          1     2
    ????          5          NULL          2     3
    ????          5          NULL          3     4
    I tried a number of different things, google my problem and no luck yet...
    SELECT     t1.workstation
    ,     SUM(t1.my_value)
    ,     t2.wkstn_name
    ,     t3.my_nbr1
    ,     t3.my_nbr2
    FROM     my_tab1 t1
    ,     my_tab2 t2
    ,     my_tab3 t3
    ...
    So, what I want, it's a full outer join of t1 and t2 on workstation and a cross join of one with the t3. I wonder if I can't find examples of it online because it is not possible...

    Note: I'm stuck dealing with Oracle 8i

    Thank you!!

    Hello

    The query I posted yesterday is a little more complex that it should be.
    My_tab2.workstation is unique, there is no reason to make a separate subquery as mt1. We can join my_tab1 to my_tab2 and get the SUM in a subquery.

    SELECT       foj.workstation
    ,       foj.sum_my_value
    ,       foj.wkstn_name
    ,       mt3.my_nbr1
    ,       mt3.my_nbr2
    FROM       (     -- Begin in-line view foj for full outer join
              SELECT        mt1.workstation
              ,        SUM (mt1.my_value)     AS sum_my_value
              ,        mt2.wkstn_name
              FROM        my_tab1   mt1
              ,        my_tab2   mt2
              WHERE        mt1.workstation     = mt2.workstation (+)
              GROUP BY   mt1.workstation
              ,        mt2.wkstn_name
                            --
                    UNION ALL
                            --
              SELECT      workstation
              ,      0      AS sum_my_value
              ,      wkstn_name
              FROM      my_tab2
              WHERE      workstation     NOT IN (     -- Begin NOT IN sub-query
                                               SELECT      workstation
                                       FROM      my_tab1
                                       WHERE      workstation     IS NOT NULL
                                     )     -- End NOT IN sub-query
           ) foj     -- End in-line view foj for full outer join
    ,       my_tab3  mt3
    ORDER BY  foj.wkstn_name
    ,       foj.workstation
    ,       mt3.my_nbr1
    ,       mt3.my_nbr2
    ;
    

    Thanks for posting the CREATE TABLE and INSERT statements, and very clear expected results!

    user11033437 wrote:
    ... So, what I want, it's a full outer join of t1 and t2 on workstation and a cross join of one with the t3.

    She, exactly!
    The trickiest part is when and how get SUM (my_value). You could address the question of exactly what my_tab3 must be attached to a cross that's exactly what should look like the result set of the full outer join between my_tab1 and my_tab2 to. To do this, take your desired results, remove columns that do not come from the outer join complete and delete duplicate rows. You will get:

    workstation     sum(my_value)     wkstn_name
    -----------     -------------   ----------
    ABCD          30          WKSTN 1
    A123          35          WKSTN 2
    B456          0          WKSTN 3
    ????          5          NULL          
    

    So the heart of the problem is how to get these results of my_tab1 and my_tab2, which is done in the subquery FOJ above.

    I tried to use auto-documenté in my code names. I hope you can understand.
    I could spend hours explaining the different parts of this query more in detail, but I don't know that I would lose some of that time, explain things that you already understand. If you want an explanation of the specific element (s), let me know.

  • Full outer join

    30%

    Hello

    I have a few questions to ask. Please see below I have provided a script to recreate my problem.

    Question 1.

    I have the following query does not work when I include columns (see 1.2) in the select but will run when I use the Asterix symbol (see 1.1)

    * 1.1 runs with no problems *.
    select *
      from ora full outer join txt on ora.ora_id_y = txt.txt_id_y;
    * 1.2 returns error.*
    select txt.txt_id_y
         , txt.txt_n
         , txt.txt_y
         , ora.ora_n
         , ora.ora_y
      from ora full outer join txt on ora.ora_id_y = txt.txt_id_y;
    
    Error report:
    SQL Error: ORA-00918: column ambiguously defined
    00918. 00000 -  "column ambiguously defined"
    *Cause:    
    *Action:
    Question 2.

    Is it possible to use a query with joins free and using multiple outer joins to accomplish what I have under which is seen 6 to access the query I have to Question 1.

    CREATE THE SCRIPT
    drop table master;
    
    create table master
    ( id varchar2 (10 char)
    , txt varchar2 (1 char)
    , ora varchar2 (1 char)
    );
    
    INSERT INTO MASTER (ID, TXT, ORA) VALUES ('orange' , 'Y', 'Y');
    INSERT INTO MASTER (ID, TXT, ORA) VALUES ('apple', 'Y', '');
    INSERT INTO MASTER (ID, TXT, ORA) VALUES ('orange'  , 'Y', 'N');
    INSERT INTO MASTER (ID, TXT, ORA) VALUES ('peach'  , 'Y', '');
    
    create or replace force view ora_n
    as
    select id
         , count (ora) ORA_N
      from master
     where ora in ('N')
     group by id;
    
    create or replace force view ora_y
    as
     select id
         , count (ora) ORA_Y
      from master
     where ora in ('Y')
     group by id;
    
    create or replace force view txt_n
    as 
     select id
         , count (txt) TXT_N
      from master
     where txt in ('N')
     group by id;
    
    create or replace force view txt_y
    as 
     select id
           , count (txt) TXT_Y
      from master
     where txt in ('Y')
     group by id;
     
    create or replace force view ora
    as 
    select ora_n.id ora_id_n
         , ora_y.id ora_id_y
         , ora_n.ora_n
         , ora_y.ora_y
      from ora_n full outer join ora_y on ora_n.id = ora_y.id;
    
    create or replace force view txt
    as 
    select txt_y.id txt_id_n
         , txt_y.id txt_id_y
         , txt_n.txt_n
         , txt_y.txt_y
      from txt_n full outer join txt_y on txt_n.id = txt_y.id; 
    Published by: benton on August 21, 2012 10:48

    Published by: benton on August 21, 2012 11:11

    Found: support for Oracle, there are:

    Bug 6319169 : ORA-918, FULL OUTER JOIN
    Reproduced on 10.2.0.1,10.2.0.3.
    Fixed to the product Version 11.0
    WORKAROUND solution: alter session set '_column_elimination_off' = true;

  • full outer join: how to get without null values?

    full outer join: how to get without null values?

    Hello

    Please go well this url

    http://asktom.Oracle.com/pls/asktom/f?p=100:11:999478429860455:P11_QUESTION_ID:6585774577187

    Thank you
    Prakash P

  • What is the Assembly of 4 or 5 tables FULL OUTER JOIN logic?

    the query is as below:

    as you can see, I need FULL OUTER JOIN, these 5 tables and get a column from each table that is based on three common columns (ORG_iD, CUST_ID, CURRENT_DT).

    And I wonder what is the logic of the 5 FULL OUTER JOIN table?
    It will return if there is a folder that exists in the single table COL1? or table, COL2 and COL3 and so on. Basically any combination of these 5 tables.

        SELECT (CASE WHEN COL1.ORG_ID IS NOT NULL THEN COL1.ORG_ID
                     WHEN COL2.ORG_ID IS NOT NULL THEN COL2.ORG_ID
                     WHEN COL3.ORG_ID IS NOT NULL THEN COL3.ORG_ID
                     WHEN COL4.ORG_ID IS NOT NULL THEN COL4.ORG_ID
                     ELSE COL5.ORG_ID 
                END) ORG_ID,
                (CASE WHEN COL1.CUST_ID IS NOT NULL THEN COL1.CUST_ID
                     WHEN COL2.CUST_ID IS NOT NULL THEN COL2.CUST_ID
                     WHEN COL3.CUST_ID IS NOT NULL THEN COL3.CUST_ID
                     WHEN COL4.CUST_ID IS NOT NULL THEN COL4.CUST_ID
                     ELSE COL5.CUST_ID
                END) CUST_ID, 
                (CASE WHEN COL1.CURRENT_DT IS NOT NULL THEN COL1.CURRENT_DT
                     WHEN COL2.CURRENT_DT IS NOT NULL THEN COL2.CURRENT_DT
                     WHEN COL3.CURRENT_DT IS NOT NULL THEN COL3.CURRENT_DT
                     WHEN COL4.CURRENT_DT IS NOT NULL THEN COL4.CURRENT_DT
                     ELSE COL5.CURRENT_DT 
                END) CURRENT_DT, 
              'VENDORS' as ITEM_NAME,
              V_AGE_IND as ACCT_AGE_IND,  
              COL1.AMT_ZSHT,  
              COL2.AMT_YFYS,  
              COL3.AMT_YFYS, 
              COL4.AMT_YFYS,  
              COL5.AMT_BZL,  
              'NAV',
              sysdate
        FROM COL1  
                  FULL OUTER JOIN COL2 ON (COL1.ORG_ID=COL2.ORG_ID AND COL1.CURRENT_DT=COL2.CURRENT_DT AND COL1.CUST_ID=COL2.CUST_ID)  
                  FULL OUTER JOIN COL3 ON (COL2.ORG_ID=COL3.ORG_ID AND COL2.CURRENT_DT=COL3.CURRENT_DT AND COL2.CUST_ID=COL3.CUST_ID)  
                  FULL OUTER JOIN COL4 ON (COL3.ORG_ID=COL4.ORG_ID AND COL3.CURRENT_DT=COL4.CURRENT_DT AND COL3.CUST_ID=COL4.CUST_ID)  
                  FULL OUTER JOIN COL5 ON (COL4.ORG_ID=COL5.ORG_ID AND COL4.CURRENT_DT=COL5.CURRENT_DT AND COL4.CUST_ID=COL5.CUST_ID)  
    Any ideas?

    Thank you

    Hello

    When you perform a JOIN EXTERNAL COMPLETE multi - build that way, whenever you add a new table, you can just join the previous table because this table could be all NULL values for a given row. You can reach each new table to the first table, either, for the same reason. You must enclose each new table with all previous tables, like this:

    FULL OUTER JOIN COL2 ON  COL2.ORG_ID     =           COL1.ORG_ID
                   AND COL2.CURRENT_DT =           COL1.CURRENT_DT
                   AND COL2.CUST_ID    =           COL1.CUST_ID
    FULL OUTER JOIN COL3 ON  COL3.ORG_ID     = COLAESCE (COL1.ORG_ID,     COL2.ORG_ID)
                   AND COL3.CURRENT_DT = COALESCE (COL1.CURRENT_DT, COL2.CURRENT_DT)
                   AND COL3.CUST_ID    = COALESCE (COL1.CUST_ID,    COL2.CUST_ID)
    FULL OUTER JOIN COL3 ON  COL4.ORG_ID     = COLAESCE (COL1.ORG_ID,     COL2.ORG_ID,     COL3.ORG_ID)
                   AND COL4.CURRENT_DT = COALESCE (COL1.CURRENT_DT, COL2.CURRENT_DT, COL3.CURRENT_DT)
                   AND COL4.CUST_ID    = COALESCE (COL1.CUST_ID,    COL2.CUST_ID,    COL3.CUST_ID)
    FULL OUTER JOIN COL3 ON  COL5.ORG_ID     = COLAESCE (COL1.ORG_ID,     COL2.ORG_ID,     COL3.ORG_ID,     COL4.ORG_ID)
                   AND COL5.CURRENT_DT = COALESCE (COL1.CURRENT_DT, COL2.CURRENT_DT, COL3.CURRENT_DT, COL4.CURRENT_DT)
                   AND COL5.CUST_ID    = COALESCE (COL1.CUST_ID,    COL2.CUST_ID,    COL3.CUST_ID,    COL4.CUST_ID)  
    

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements), and the results you want from this data.
    Explain how you get these results from these data.
    Always tell what version of Oracle you are using.

  • Diff "full outer join" is going. "(+)" SELECT syntax?

    As far as I know there are two ways to set an outer join:

    Select... from tab1 external t1 full join tab2 t2 on t1.id = t2.id;
    or:
    SELECT... from tab1 tab2 t2, t1 where t1.id = t2.id (+)

    They are absolutely equivialent?

    Who are the most common one?

    Who serve as well on other databases (DB2, MySQL)?

    Can I put an additional WHERE clause at the end of the first statement:

    SELECT... from tab1 t1 outer join t2 on t1.id = t2.id tab2 complete WHOSE...;

    Select... from tab1 external t1 full join tab2 t2 on t1.id = t2.id;

    It's FULL OUTER JOIN

    SELECT... from tab1 tab2 t2, t1 where t1.id = t2.id (+)

    It's LEFT OUTER JOIN.

    They are quite different.

    FULL OUTER JOIN - retrieves all the rows from tab1 and tab2

    LEFT OUTER JOIN - gets all the tab1 and lines than the line that matches the join condition of tab2.

    Here is a simple test.

    create table tab1(id integer)
    /
    create table tab2(id integer)
    /
    begin
      insert into tab1 values(1);
      insert into tab1 values(2);
      insert into tab1 values(3);
    end;
    /
    begin
      insert into tab2 values(3);
      insert into tab2 values(4);
      insert into tab2 values(5);
    end;
    /
    Select t1.id, t2.id
      from tab1 t1 full outer join tab2 t2
        on t1.id =t2.id
    /
    Select t1.id, t2.id
      from tab1 t1, tab2 t2
     where t1.id = t2.id(+)
    /
    

    Run it and see the result.

  • Need help with outer join

    Hello

    I have a requirement in which I need to get data from a third table where a date of the third table is higher than a date in the second array.

    Ex:

    SELECT t1.column1, t3.column2
    FROM t1, t2, t3
    WHERE t1.id = t2.foreign_id
    AND t1.id ( + ) = t3.foreign_id
    AND t3.some_date_column > t2.another_date_column
    
    

    However, using the query above returns no results if the date condition is not met. I still need to show t1.column1 and a null t3.column2.

    How should I do this?

    Thank you

    Allen

    Edit: Added information about the requirement.

    Hi Allen

    1. SELECT t1.column1, t3.column2
    2. T1, t2, t3
    3. WHERE t1.id = t2.foreign_id
    4. AND t1.id = t3.foreign_id (+)
    5. AND t3.some_date_column (+) > t2.another_date_column

    I guess that this t1.column1 must not be null. Or am I wrong? The + sign must be placed on the side where draws are accepted. You must repeat it for each condition on the table.

    Alternativlely you can use the LEFT OUT JOIN syntax. If the two columns are allowed null you need a FULL OUTER JOIN.

    BTW: The join to t2 is not required if a refefernce constraint forced.

  • Effort using Outer join parent-child relationship

    Oracle Database 10 g Express Edition Release 10.2.0.1.0 - product

    I have the following tables

    CREATE TABLE  "ADDPROJECT" 
       (     "PROJID" VARCHAR2(30) NOT NULL ENABLE, 
         "PROJNAME" VARCHAR2(30), 
         "PROJSTARTDATE" DATE, 
         "PROJENDDATE" DATE, 
         "PARENTPROJID" VARCHAR2(30), 
         "PROJTYPE" VARCHAR2(30), 
         "PROJSTATUS" VARCHAR2(30), 
          PRIMARY KEY ("PROJID") ENABLE
       )
    
    CREATE TABLE  "ALLOCATEASSOCIATES" 
       (     "PROJID" VARCHAR2(30) NOT NULL ENABLE, 
         "ASSOCIATEID" NUMBER(*,0) NOT NULL ENABLE, 
         "ALLOCATIONSTARTDATE" DATE, 
         "ALLOCATIONPERCENT" NUMBER(*,0), 
         "ENDDATE" DATE, 
          PRIMARY KEY ("PROJID", "ASSOCIATEID") ENABLE
       )
    
    CREATE TABLE  "ADDRESEARCHAREA" 
       (     "RAID" VARCHAR2(30) NOT NULL ENABLE, 
         "RANAME" VARCHAR2(30), 
         "RASTARTDATE" DATE, 
         "RAENDDATE" DATE, 
         "PARENTRAID" VARCHAR2(30), 
         "RASTATUS" VARCHAR2(30), 
          PRIMARY KEY ("RAID") ENABLE
       )
    
    CREATE TABLE  "PROJECTTORAASSOCIATION" 
       (     "RAID" VARCHAR2(30) NOT NULL ENABLE, 
         "PROJID" VARCHAR2(30) NOT NULL ENABLE, 
         "STARTDATE" DATE, 
         "ENDDATE" DATE, 
         "STATUS" VARCHAR2(30), 
          PRIMARY KEY ("RAID", "PROJID") ENABLE
       )
    
    insert into addresearcharea values ('ra1','raname1',to_date('04/01/2012','mm/dd/yyyy'),'','','Active')
    insert into addresearcharea values ('ra2','raname2',to_date('04/01/2012','mm/dd/yyyy'),'','','Active')
    insert into addresearcharea values ('ra3','raname3',to_date('04/01/2012','mm/dd/yyyy'),'','','Active')
    insert into addresearcharea values ('ra4','raname4',to_date('04/01/2012','mm/dd/yyyy'),'','ra1','Active')
    insert into addresearcharea values ('ra5','raname5',to_date('04/01/2012','mm/dd/yyyy'),'','ra1','Active')
    insert into addresearcharea values ('ra6','raname6',to_date('04/01/2012','mm/dd/yyyy'),'','ra2','Active')
    
    insert into addproject values ('proj1','projname1',to_date('04/01/2012','mm/dd/yyyy'),'','','Research','Active')
    insert into addproject values ('proj2','projname2',to_date('04/01/2012','mm/dd/yyyy'),'','','Research','Active')
    insert into addproject values ('proj3','projname3',to_date('04/01/2012','mm/dd/yyyy'),'','','Research','Active')
    
    insert into projecttoraassociation values ('ra1','proj1',to_date('04/01/2012','mm/dd/yyyy'),'','Active')
    insert into projecttoraassociation values ('ra4','proj1',to_date('04/01/2012','mm/dd/yyyy'),'','Active')
    insert into projecttoraassociation values ('ra2','proj2',to_date('04/01/2012','mm/dd/yyyy'),'','Active')
    insert into projecttoraassociation values ('ra3','proj3',to_date('04/01/2012','mm/dd/yyyy'),'','Active')
    
    insert into allocateassociates values ('proj1',1,to_date('04/01/2012','mm/dd/yyyy'),100,'')
    insert into allocateassociates values ('proj1',2,to_date('04/01/2012','mm/dd/yyyy'),100,'')
    insert into allocateassociates values ('proj2',3,to_date('04/01/2012','mm/dd/yyyy'),100,'')
    In short, here is the data

    Research areas: ra1, ra2, ra3
    Void / areas of research for AM1: ra4, ka5
    Void / areas of research for ra2: qxf6
    Void / areas of research for ra3: -.

    Projects - proj1, proj2.proj3

    Mapping of the area of research projects
    Proj1: ra1 and ra4
    Proj2: ra2

    Associate the allocation
    Proj1: 1,2
    Proj2: 3

    I need to get wise effort search space and subarea displayed on the same row (if the project is also associated with the search of sub box)
    The user must be able to choose a particular area of research and the results displayed accordingly
    Results expected in the cases where no specific research field are selected
    EFFORT PROJECTID PROJECTNAME RANAME SUBRANAME 
    12.70 proj1 projname1 raname1 ra4 
    6.35 proj2 projname2 raname2 - 
    - proj3 projname3 raname3 - 
    Production in the event of main search box is selected (for example:-ra1)
    EFFORT PROJECTID PROJECTNAME RANAME SUBRANAME 
    12.70 proj1 projname1 raname1 ra4 
    The expected results in the area of research case void are selected (for example:-ra4)
    EFFORT PROJECTID PROJECTNAME RANAME SUBRANAME 
    12.70 proj1 projname1 raname1 ra4 
    The query I wrote
    SELECT 
    to_char(
        SUM(
           (MONTHS_BETWEEN(
                   1+LEAST(
                      LEAST(
                         LEAST(
                              nvl(ar.raenddate,to_date('04/01/2100','mm/dd/yyyy'))
                              ,nvl(pr.enddate,to_date('04/01/2100','mm/dd/yyyy')))
                      ,nvl(aa.enddate,to_date('04/01/2100','mm/dd/yyyy')))
                  ,sysdate),
                  GREATEST(
                     GREATEST(
                        GREATEST(
                                ar.rastartdate
                                ,pr.startdate)
                           ,aa.allocationstartdate)
                  ,to_date('04/01/2012','mm/dd/yyyy'))) 
        * aa.allocationpercent / 100 
        ))
      ,999.99)    AS EFFORT,
    aa.projid AS PROJECTID,
    ap.projname AS PROJECTNAME,
    ar.raname AS RANAME,
    ar2.raid AS SUBRANAME
    FROM AllocateAssociates aa,ProjecttoRAAssociation pr,addProject ap,AddResearchArea ar, AddResearchArea ar2
    WHERE pr.projid = aa.projid (+)
    AND aa.projid = ap.projid 
    AND pr.raid = ar.raid
    AND ar.raid = ar2.parentraid (+)
    group by aa.projid,ap.projname,ar.raname,ar2.raid
    The problems I am facing
    1. I need to get a list of projects that are associated with the search box even if they have no allocation of project. Although I used the outer join, I don't get this result. I used the full outer join, but gave the expected result. (Since there are several tables to assemble. maybe something wrong to join to?) (in the above data, proj3 must also be displayed even if it doesn't have an allocation of project)
    2. If a search box has more than one field of research, there are 2 entries for each sub research field even if the project has been associated with the search under a single box (in the above data, the proj1 has been associated with ra4 only, but the results display the ra4 and ka5)
    3. the query shows two entries for the main research area and one for the research sub area (provided that the project is associated with the correct principal and under research field). But there should be just an entry in a space research containing the name of the two main and under research field

    Please help me to solve these problems.
  • left and right outer join

    Hi gurus,

    Left outer join:

    -------------------

    Select * from A LEFT OUTER JOIN B on A.col = B.col;

    by definition, a left outer join brings the rows that match the join condition and lines not corresponding to table A.

    My question here is "corresponding to B and no matching rows in A" is that nothing, but... SELECT * FROM A;

    can someone pls clarity...

    Thank you.

    Imagine that you had:

    TableA

    COLUMN1 COLUMN2

    'A'                1

    'B'                2

    'C'                3

    TABLEB

    COLUMN1 COLUMN2

    'A'                 'X1'

    'A'                 'X2'

    'B'                 'Y'

    'D'                 'Z'

    SELECT * FROM TABLEA;

    A 1

    B 2

    C 3

    Now, if you want to join (first column is either in table A or B, (deuxieme from tableA, third table B)

    SELECT * FROM TABLEA A JOIN TABLEB B ON (A.COLUMN1 = B.COLUMN1)

    A 1 X 1

    A 1 X 2

    B 2 Y

    SELECT * FROM TABLE LEFT B EXTERNAL ON (A.COLUMN1 = B.COLUMN1) JOIN TABLE

    A 1 X 1

    A 1 X 2

    B 2 Y

    C 3 {null}

    SELECT * FROM TABLE A TABLE RIGHT OUTER JOIN B (A.COLUMN1 = B.COLUMN1)

    A 1 X 1

    A 1 X 2

    B 2 Y

    D {null} Z

    SELECT * FROM TABLE A TABLE FULL OUTER JOIN B (A.COLUMN1 = B.COLUMN1)

    A 1 X 1

    A 1 X 2

    B 2 Y

    C 3 {null}

    D {null} Z

    HTH

  • FULLT OUTER JOIN on two different selects

    Hello

    I am facing a problem where I don't just get the handle to solve.

    I have two pieces of music with different return values. This value should be compared and joined. Simply put, I do an example where the return of the selection is represented as the table1 and table2
    Here is the example:
    table1
    abc_comp_nr, abc_cnt_emp
    12000, 15
    12500, 10
    13000, 30
    13500, 10
    
    table2
    xyz_comp_nr, xyz_cnt_emp
    12000, 15
    13000, 30
    14000, 20
    
    Output should be this:
    comp_nr, abc_cnt_emp, xyz_cnt_emp
    12000, 15, 15
    12500, 10, 0
    13000, 30, 30
    13500, 10, 0
    14000, 0, 20
    comp_nr is the combination of abc_comp_nr or xyz_comp_nr

    I tried this but did not work as expected:
    Select?, abc_cnt_emp, xyz_cnt_emp
    Of
    Table1 FULL OUTER JOIN table2
    ON abc_comp_nr = xyz_comp_nr

    Hope that someone was in trouble similar and found a good way to work it.

    Thanks in advance

    Tobias

    Hi, Tobias,.

    Tobias Arnhold wrote:
    Hello

    I am facing a problem where I don't just get the handle to solve.

    I have two pieces of music with different return values. This value should be compared and joined. Simply put, I do an example where the return of the selection is represented as the table1 and table2
    Here is the example:

    table1
    abc_comp_nr, abc_cnt_emp
    12000, 15
    12500, 10
    13000, 30
    13500, 10
    
    table2
    xyz_comp_nr, xyz_cnt_emp
    12000, 15
    13000, 30
    14000, 20
    

    Whenever you have a problem, post CREATE TABLE and INSERT statements for the sample data.
    See the FAQ forum {message identifier: = 9360002}

    Output should be this:
    comp_nr, abc_cnt_emp, xyz_cnt_emp
    12000, 15, 15
    12500, 10, 0
    13000, 30, 30
    13500, 10, 0
    14000, 0, 20
    

    comp_nr is the combination of abc_comp_nr or xyz_comp_nr

    I tried this but did not work as expected:
    Select?, abc_cnt_emp, xyz_cnt_emp
    Of
    Table1 FULL OUTER JOIN table2
    ON abc_comp_nr = xyz_comp_nr

    Instead of??? you want to

    NVL (abc_comp_nr, xyz_comp_nr)
    

    The first column is supposed to be the common identifier, abc_comp_nr, or xyz_comp_nr. It doesn't matter which, since the join condition

    ON abc_comp_nr = xyz_comp_nr
    

    said they will be the same, except that it's a FULL OUTER JOIN, if one of them might be null. If you want to display the non NULL when one of them is NULL and or the other (any) when they are both present. It's just that NVL.

    You can use NVL on other columns, too, to display 0 instead of NULL when there is no match:

    SELECT   NVL ( abc_comp_nr, xyz_comp_nr)     AS comp_nr
    ,        NVL ( abc_cnt_emp, 0)               AS abc_cnt_emp
    ,      NVL ( xyz_cnt_emp, 0)               AS xyz_cnt_emp
    FROM              table1
    FULL OUTER JOIN  table2  ON  abc_comp_nr  = xyz_comp_nr
    ;
    

    However, this will display 0 instead of NULL for abc_cnt_emp and xyz_cnt_emp when these columns are NULL for a reason, not just at the time when they do not reach the join condition. If the original paintings contain NULL values and you should keep NULL values in the result set, but you want NULLs which were created by the outer join to show as 0, then you may want something like this:

    SELECT   NVL ( abc_comp_nr, xyz_comp_nr)     AS comp_nr
    ,        NVL2 ( abc_comp_nr, abc_cnt_emp, 0)     AS abc_cnt_emp
    ,      NVL2 ( xyz_comp_nr, xyz_cnt_emp, 0)     AS xyz_cnt_emp
    FROM              table1
    FULL OUTER JOIN  table2  ON  abc_comp_nr  = xyz_comp_nr
    ;
    

    Whenever you use FULL OUTER JOIN, there is an excellent chance that you will want to use NVL (or his brother younger, stronger, COALESCE, or their cousin NVL2) as well.

    Published by: Frank Kulash on 3 March 2013 14:49

  • complete elimination of an outer join

    Hi all

    I'm reporting two fact tables. However, despite the use of inner joins only in the RPD, obiee generates a full outer joins between the two WITH (subquery factoring). Is it possible to apply inner joins.

    Thank you

    Surya

    872073 wrote:
    All in RPD joins are inner joins. The generated query is similar as follows. The full outer join is created automatically between SAWITH0 SAWITH1

    WITH
    SAWITH0 AS (SELECT sum (T245. QUANTITY_SOLD) AS c1,.
    T161. CHANNEL_DESC AS c2
    Of
    SH. T161 CHANNELS,
    HS SALES T245
    WHERE (T161. CHANNEL_ID = T245. CHANNEL_ID)
    T161 GROUP. CHANNEL_DESC),
    SAWITH1 AS (SELECT sum (T168. UNIT_COST) AS c1,.
    T161. CHANNEL_DESC AS c2
    Of
    SH. T161 CHANNELS,
    HS FEES T168
    WHERE (T161. CHANNEL_ID T168 =. CHANNEL_ID)
    T161 GROUP. CHANNEL_DESC)
    SELECT DISTINCT cases where SAWITH1.c2 IS NOT NULL, then SAWITH1.c2 when SAWITH0.c2 IS NOT NULL then SAWITH0.c2 end AS c1,
    C2 SAWITH0. C1 DID,
    SAWITH1. C1 AS c3
    Of
    SAWITH0 FULL OUTER JOIN SAWITH1 ON SAWITH0.c2 = SAWITH1.c2
    ORDER BY c1

    If I change the underlined FULL OUTER JOIN just preceding 'JOIN', the query returns I want.

    Published by: 872073 on October 24, 2012 13:14

    Check if PERF_PREFER_INTERNAL_STITCH_JOIN has been disabled in the file DB Features.ini

    The path to the file is Oracle/Middleware/instances/instance1/config/OracleBIServerComponent/coreapplication_obis1/DBFeatures.INI

  • Outer join issues

    Hi guys,.

    I use Oracle 10 G database. When I run the query below, I am of course a mistake given that an outer join more then one table:
    ---------------------
    SELECT
      MV_VAA_INC_MONTHLY_SUMMARY.Month_ID,
      MV_VAA_INC_MONTHLY_SUMMARY.PRIORITY,
      sum(MV_VAA_INC_MONTHLY_SUMMARY.CLOSED),
      decode(MV_VAA_INC_MONTHLY_SUMMARY.SLA_MET, 1, 0, 1),
      MV_VAA_INC_MONTHLY_SUMMARY.INCIDENT_NUMBER,
      to_char(MV_VAA_INC_MONTHLY_SUMMARY.FIRST_DAY_OF_THE_MONTH, 'Mon')||' '||to_char(MV_VAA_INC_MONTHLY_SUMMARY.FIRST_DAY_OF_THE_MONTH, 'yy'),
      INC_BREACH_SLA_DETAILS.RESPONSIBILITY
    FROM
      MV_VAA_INC_MONTHLY_SUMMARY , HPD_HELP_DESK,
       INC_BREACH_SLA_DETAILS,
       MIS_QUEUES_RESP  INC_MIS_QUEUES_RESP  
    WHERE
      (
       ( INC_MIS_QUEUES_RESP.RESP = ANY ('TCS', 'NONTCS')  )
       AND
       ( ( MV_VAA_INC_MONTHLY_SUMMARY.FIRST_DAY_OF_THE_MONTH ) BETWEEN ( add_months(trunc(sysdate,'MM'), -4) ) AND ( trunc(sysdate,'MM') -1 )  )
       AND
       MV_VAA_INC_MONTHLY_SUMMARY.Month_ID = 201110
       AND
       MV_VAA_INC_MONTHLY_SUMMARY.INCIDENT_NUMBER (+) = HPD_HELP_DESK.INCIDENT_NUMBER
       AND
       INC_BREACH_SLA_DETAILS.INCIDENT_NUMBER=HPD_HELP_DESK.INCIDENT_NUMBER (+)
       AND 
       INC_MIS_QUEUES_RESP.SUPPORT_GROUP_ID=HPD_HELP_DESK.ASSIGNED_GROUP_ID (+)
      )
    GROUP BY
      MV_VAA_INC_MONTHLY_SUMMARY.Month_ID, 
      MV_VAA_INC_MONTHLY_SUMMARY.PRIORITY, 
      decode(MV_VAA_INC_MONTHLY_SUMMARY.SLA_MET, 1, 0, 1), 
      MV_VAA_INC_MONTHLY_SUMMARY.INCIDENT_NUMBER, 
      to_char(MV_VAA_INC_MONTHLY_SUMMARY.FIRST_DAY_OF_THE_MONTH, 'Mon')||' '||to_char(MV_VAA_INC_MONTHLY_SUMMARY.FIRST_DAY_OF_THE_MONTH, 'yy'), 
      INC_BREACH_SLA_DETAILS.RESPONSIBILITY
    HAVING
      sum(MV_VAA_INC_MONTHLY_SUMMARY.CLOSED)  =  1
    ---------------------

    But when I run the sub query quite similar, I do not receive an error.

    -------------------------
    SELECT
      MV_VAA_INC_MONTHLY_SUMMARY.Month_ID,
      MV_VAA_INC_MONTHLY_SUMMARY.PRIORITY,
      sum(MV_VAA_INC_MONTHLY_SUMMARY.CLOSED),
      decode(MV_VAA_INC_MONTHLY_SUMMARY.SLA_MET, 1, 0, 1),
      MV_VAA_INC_MONTHLY_SUMMARY.INCIDENT_NUMBER,
      to_char(MV_VAA_INC_MONTHLY_SUMMARY.FIRST_DAY_OF_THE_MONTH, 'Mon')||' '||to_char(MV_VAA_INC_MONTHLY_SUMMARY.FIRST_DAY_OF_THE_MONTH, 'yy'),
      INC_BREACH_SLA_DETAILS.RESPONSIBILITY
    FROM
      MV_VAA_INC_MONTHLY_SUMMARY RIGHT OUTER JOIN HPD_HELP_DESK ON (MV_VAA_INC_MONTHLY_SUMMARY.INCIDENT_NUMBER=HPD_HELP_DESK.INCIDENT_NUMBER)
       LEFT OUTER JOIN INC_BREACH_SLA_DETAILS ON (INC_BREACH_SLA_DETAILS.INCIDENT_NUMBER=HPD_HELP_DESK.INCIDENT_NUMBER)
       LEFT OUTER JOIN MIS_QUEUES_RESP  INC_MIS_QUEUES_RESP ON (INC_MIS_QUEUES_RESP.SUPPORT_GROUP_ID=HPD_HELP_DESK.ASSIGNED_GROUP_ID)  
    WHERE
      (
       ( INC_MIS_QUEUES_RESP.RESP = ANY ('TCS', 'NONTCS')  )
       AND
       ( ( MV_VAA_INC_MONTHLY_SUMMARY.FIRST_DAY_OF_THE_MONTH ) BETWEEN ( add_months(trunc(sysdate,'MM'), -4) ) AND ( trunc(sysdate,'MM') -1 )  )
       AND
       INC_BREACH_SLA_DETAILS.RESPONSIBILITY  NOT IN  ( 'NONE'  )
       AND 
       MV_VAA_INC_MONTHLY_SUMMARY.Month_ID = 201110
      )
    GROUP BY
      MV_VAA_INC_MONTHLY_SUMMARY.Month_ID, 
      MV_VAA_INC_MONTHLY_SUMMARY.PRIORITY, 
      decode(MV_VAA_INC_MONTHLY_SUMMARY.SLA_MET, 1, 0, 1), 
      MV_VAA_INC_MONTHLY_SUMMARY.INCIDENT_NUMBER, 
      to_char(MV_VAA_INC_MONTHLY_SUMMARY.FIRST_DAY_OF_THE_MONTH, 'Mon')||' '||to_char(MV_VAA_INC_MONTHLY_SUMMARY.FIRST_DAY_OF_THE_MONTH, 'yy'), 
      INC_BREACH_SLA_DETAILS.RESPONSIBILITY
    HAVING
      sum(MV_VAA_INC_MONTHLY_SUMMARY.CLOSED)  =  1
    -------------------------

    Please can you advise the reason.

    See you soon,.
    Khadi

    Published by: BluShadow on November 11, 2011 10:54
    addition of {noformat}
    {noformat} tags. Please read {message:id=9360002} and learn to do this yourself.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

    Hi, yaya,

    888121 wrote:
    Hi guys,.

    In fact I'm not guru in Oracle as such. The first query, I pasted works well.

    You mean the second query (one with ANSI joins) is running fine and the first query (with signs +) is a mistake, right?

    Looking at this request I created the joins in the second, but then I get this error. I just want to understand what is the difference in the ANSI query and mine is throwing this error.

    Join ANSI rating supports outer joins to more than one table; the old syntax doesn't work. That's all there is to it. The ANSI syntax also supports FULL OUTER JOIN, and the old syntax does not work. There is nothing wrong with more than one table outer join, just as there is nothing wrong with a full outer join. You can do it with the old syntax, but just more coding.

    Published by: Frank Kulash, November 11, 2011 08:16

  • using (+) or left outer join

    Dear Expert;

    I've been playing by using the two symbol... and realized that they do the same thing... Is it true...? or am I wrong.

    Thank you.

    Hello

    user13328581 wrote:
    Dear Expert;

    I've been playing by using the two symbol... and realized that they do the same thing... Is it true...? or am I wrong.

    They all have two outer joins. The + rating was the original way to do it in Oracle. LEFT, RIGHT, and FULL OUTER JOIN introduced in Oracle 9, but the old way is still supported.

    There are some situations (such as an outer join complete and outer-join a table to two different tables) that are better with the ANSI syntax (it's LEFT OUTER JOIN). It is possible to get the same results using +, but it must be combersome and/or inefficient workarounds. I suggest that you use always LEFT OUTER JOIN (or FULL OUTER JOIN, or, on occasions RIGHT OUTER JOIN). I think that you will find it easier and less error-prone.

Maybe you are looking for

  • Sat Pro L10: LCD screen and market off button / stop

    Ive had my L10, little more than a week and im having problems with the on off button does not turn on the laptop properly, so I need to keep it easy on and outside. After awhile, it will load up finally. However now wen it starts after about 5 minut

  • Disc SSD on Qosmio F60

    Is there room on the drive, an SSD drive in my laptop, Qosimo F60 Thank you

  • HP z420 drivers missing

    Help! I need drivers for Hp z420 workstation Win 7 pro 64-bit for both the Base system device PCI\VEN_8086 & DEV_0E28 & CC_0880 PCI\VEN_8086 & DEV_0E2A & CC_0880 And the interruption of system controller PCI\VEN_8086 & DEV_0E2C & CC_0800 Thank you...

  • The specified service does not exist as an installed service

    Recently I seem to have problem with every thing in my laptop under windows vistas. When I try to open any program such as device 1 Manager) 2) install/uninstall any program 3) manage computer 4) remove a printer, etc., it gives only the error "the s

  • Upgrade of RAM/video graphics

    Does anyone know if when I upgrade the Ram on my laptop of 16Gig 6Gig is it possible to change the graphics video memory of 2Gig dedicated to something more? I have the HP Envy M6-1150sa Intel i3 2.4 Ghz processor, Windows 8, graphics card Radeon HD