Outer join problem

Hi, I have a problem with my query:

SELECT t1.step, t2.name FROM RIGHT JOIN t1 t2 ON t2.step = t1.step

I have two tables, small t1 and t2 great.

table T1 (7 lines):

name of the step

1 a

2B

3 C

4 D

5 e

$4

7 g

table T2 (10000 lines);

name of the step ID

100 1A

101 2B

102 3 c

103 4 D

104 5th

105 1A

106 2 b

107 3 c

108 d 4

109 5 e

110 1A

111 2B

112 3 c

113 4 D

114 5 e

115 1A

116 2B

117 c 3

118 d 4

119 5th

… … ..

I want external right to join them, and have values in t2.name NULL and the range of steps (1-7).

My query returns this:

name of the step

1 a

2B

3 C

4 D

5 e

1 a

2B

3 C

4 D

5 e

1 a

2B

3 C

4 D

5 e

....

Thank you.

So there is indeed a key score in T2, it is "ROW_NR", and we can do this:

select t1.col_nr
    , t2.row_nr
    , t1.sheet_name
    , t1.cell
    , t1.column_name
    , t2.string_val
from t1
    left outer join t2 partition by (t2.row_nr)
                  on t2.col_nr = t1.col_nr
;

Tags: Database

Similar Questions

  • Outer join problem - revisited

    Hello
    I'm starting a new thread since my previous post was an inaccurate representation of the problem I have.

    I have data that looks like this.

    create table cour_off (offNum number, varchar2 (10) courseId, start_date date);
    create table activity (number oid, courseId varchar2 (10));
    create table ncr_course (course_oid number, incept_date date, expiry_date date);

    insert into cour_off values (1, 'MAT101', to_date (' 15 / 05/2012 ', ' DD/MM/YYYY'));
    Insert in activity values (10, 'MAT101');
    insert into ncr_course values (10, to_date (' 01 / 05/2012 ', ' DD/MM/YYYY'), to_date (' 10 / 05/2012 ', ' DD/MM/YYYY'));

    When I write the query using ANSI notation, the query works fine. 1 form is returned with a NULL value for the incept_date column.

    Select activity.courseId, ncr_course.incept_date
    of cour_off
    Join the activity on cour_off.courseId = activity.courseId
    activity.Oid left join ncr_course = ncr_course.course_oid
    and cour_off.start_date between ncr_course.incept_date
    and ncr_course.expiry_date
    where cour_off.offNum = 1

    However, when the style non ANSI query as shown below, no records are returned.

    Select activity.courseId, ncr_course.incept_date
    activity, cour_off, ncr_course
    where cour_off.offNum = 1
    and cour_off.courseId = activity.courseId
    and activity.oid = ncr_course.course_oid (+)
    and cour_off.start_date between ncr_course.incept_date and ncr_course.expiry_date

    I would like to know how I can resolve the application of style not ANSI so that the 1 record is returned.

    Thank you!

    Well, native Oracle outer join does not allow outside join two tables, to do something like:

    select courseId, ncr_course.incept_date
    from (
          select activity.courseId,
                 activity.oid,
                 cour_off.start_date
            from cour_off, activity
            where cour_off.offNum = 1
              and cour_off.courseId = activity.courseId
         ), ncr_course
    where oid = ncr_course.course_oid(+)
    and start_date between ncr_course.incept_date(+) and ncr_course.expiry_date(+)
    /
    
    COURSEID   INCEPT_DA
    ---------- ---------
    MAT101
    
    SQL> 
    

    SY.

  • Outer join - problem with the name of the table in the select list

    Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production

    create table (j1)

    number of C1,

    number of C2);

    create table (j2)

    number of C1,

    number of C2);

    insert into values j1 (1, 10);

    insert into j1 values (1, 100);

    insert into values j1 (1, 1000);

    insert into values j2 (1, 2);

    insert into values j2 (1, 4);

    insert into values j2 (1, 8);

    commit;

    Select c1, j1.c2, j2.c2 of outer join of j1 j2 using (c1); - DOES NOT

    Select c1, j1 j2 (c1) using outer join j2.c2. - WORK

    Why?

    Hello

    Interesting question!  Oracle goes very far in trying not to trigger an error.

    The OUTER keyword (if used; it is always optional) must be preceded by one of the keywords, right or LEFT.  Since neither LEFT, RIGHT, or FULL comes before OUTER in queries in your first message, it does not recognize as keyword OUTER and treats him like a table alias for table j1.  Since j1 has an alias, the real table name cannot be used in the SELECT clause.  This query is executed:

    SELECT c1

    outer.c2

    j2.c2

    External J1

    Join the HELP of j2 (c1)

    ;

    There is an INTERNAL join.  Add to your sample data:

    insert into values of j1 (-1, -10);

    insert into values of j2 (-2, -20);

    to be specified.

    Moreover, USING is short for confUSING.  I suggest you use IT for all the join conditions.  Everyone (unless they you write or read a manual) does.

  • Performance of outer join problem

    Dear all,

    Please help me in the development the sub query as it is particularly the outer join and goes for full scan of the table.

    Query:
    SELECT
    T27. CONFLICT_ID,
    T27. LAST_UPD,
    T27. CREATED,
    T27. LAST_UPD_BY,
    T27. CREATED_BY,
    T27. MODIFICATION_NUM,
    T27. ROW_ID,
    T24. ATTRIB_39,
    T27. REMIT_ADDR_ORG_ID,
    T27. REMIT_ORG_EXT_ID,
    T16.NAME,
    T25. ACCNT_TYPE_CD,
    T27. RECAL_TAX_SRV_FLG,
    T27. PROJ_ID,
    T8. PROJ_NUM,
    T8. BU_ID,
    T5.NAME,
    T8. INTEGRATION_ID,
    T12. CURCY_CD,
    T25. PR_BL_ADDR_ID,
    T25. URL,
    T27. TTL_INVC_AMT,
    T27. INVC_TYPE_CD,
    T27. TTL_PD_AMT,
    T3. CG_ASSSET_ID,
    T17. ASSET_NUM,
    T27. VENDR_INVOICE_NUM,
    T4. TOT_QTY_SHIP,
    T4. TOT_EXTND_PRICE,
    T27. ACCNT_ID,
    T25. INTEGRATION_ID,
    T25.NAME,
    T25. BU_ID,
    T25. AVAIL_CREDIT_AMT,
    T10.NAME,
    T27. AGREEMENT_ID,
    T4. TOT_EXTND_TAX,
    T27. STMT_SOURCE_CD,
    T4. SRC_INVLOC_ID,
    T27. STATUS_CD,
    T4. TOT_QTY_BONUS,
    T27. X_DEPOSIT_AMT,
    T27.COMMENTS,
    T27. INVC_FULLY_PAID_DT,
    T26. SEQ_NUM,
    T27. ELEMENT_ID,
    T26. INSCLM_ID,
    T14. INSCLAIM_NUM,
    T27. BL_PER_ID,
    T27. INS_CLAIM_ID,
    T27. FN_ACCNT_ID,
    T27. CUSTOMER_REF_NUM,
    T27. TTL_NONREC_AMT,
    T25. OU_NUM,
    T24. ATTRIB_39,
    T27. AMT_CURCY_CD,
    T2. CCNUM_ENCRPKEY_REF,
    T18. PR_DEPOSIT_ID,
    T19. DISCNT_RULE_CD,
    T27. ORDER_ID,
    T4. STATUS_CHG_FLG,
    T25. MAIN_PH_NUM,
    T25. MAIN_FAX_PH_NUM,
    T27. DELINQUENT_FLG,
    T15. OPENING OF SESSION
    T25. PR_POSTN_ID,
    T4. ORDER_NUM,
    T22. ADDR,
    T22. Zip code
    T27. INVC_NUM,
    T27. INVC_DT,
    T22. COUNTRIES,
    T22. CITY,
    T27. BL_ADDR_ID,
    T23.NAME,
    T27. POSTED_DT,
    T20.NAME,
    T27. BL_PERIOD_ID,
    T27. GOODS_DLVRD_TS,
    T23.NET_DAYS,
    T27. PAYMENT_TERM_ID,
    T23. DUE_DT,
    T27. DUE_DT,
    T27. VOID_REASON_TEXT,
    T27. DEPT_CD,
    T24. ATTRIB_60,
    T24. ATTRIB_28,
    T21. AMT,
    T1. STATE,
    T1. ADDR,
    T1. ADDR_LINE_2,
    T1. COUNTRIES,
    T1. CITY,
    T1. Zip code
    T11. OPENING OF SESSION
    T21. ROW_ID,
    T9. ROW_ID,
    T1. ROW_ID,
    T13. ROW_ID,
    T7. ROW_ID
    Of
    SIEBEL. S_ADDR_PER T1,
    SIEBEL. S_PTY_PAY_PRFL T2,
    SIEBEL. S_INVLOC T3,
    SIEBEL. S_ORDER T4,
    SIEBEL. S_ORG_EXT T5,
    SIEBEL. S_POSTN T6,
    SIEBEL. S_PARTY T7,
    SIEBEL. S_PROJ T8,
    SIEBEL. S_CON_ADDR T9,
    SIEBEL. S_ORG_EXT T10,
    SIEBEL. S_USER T11,
    SIEBEL. S_DOC_QUOTE T12,
    SIEBEL. S_ACCNT_POSTN T13,
    SIEBEL. S_INS_CLAIM T14,
    SIEBEL. S_USER T15,
    SIEBEL. S_ORG_EXT T16,
    SIEBEL. T17 S_ASSET,
    SIEBEL. S_ORDER_TNTX T18,
    SIEBEL. S_ORG_EXT_TNTX T19,
    SIEBEL. S_PERIOD T20,
    SIEBEL. S_DEPOSIT_TNT T21,
    SIEBEL. T22 S_ADDR_PER,
    SIEBEL. T23 S_PAYMENT_TERM,
    SIEBEL. S_ORG_EXT_X T24,
    SIEBEL. S_ORG_EXT T25,
    SIEBEL. S_INSCLM_ELMNT T26,
    SIEBEL. S_INVOICE T27
    WHERE
    T25. BU_ID = T10. PAR_ROW_ID (+) AND
    T26. INSCLM_ID = T14. ROW_ID (+) AND
    T27. ELEMENT_ID = T26. ROW_ID (+) AND
    T27. LAST_UPD_BY = T15. PAR_ROW_ID (+) AND
    T4. QUOTE_ID = T12. ROW_ID (+) AND
    T3. CG_ASSSET_ID = T17. ROW_ID (+) AND
    T27. BL_ADDR_ID = T22. ROW_ID (+) AND
    T8. BU_ID = T5. PAR_ROW_ID (+) AND
    T27. PER_PAY_PRFL_ID = T2. ROW_ID (+) AND
    T27. REMIT_ORG_EXT_ID = T16. PAR_ROW_ID (+) AND
    T27. PROJ_ID = T8. ROW_ID (+) AND
    T27. BL_PERIOD_ID = T20. ROW_ID (+) AND
    T27. PAYMENT_TERM_ID = T23. ROW_ID (+) AND
    T12. BU_ID = T19. PAR_ROW_ID (+) AND
    T27. ACCNT_ID = T25. PAR_ROW_ID (+) AND
    T27. ORDER_ID = T18. ROW_ID (+) AND
    T4. SRC_INVLOC_ID = T3. ROW_ID (+) AND
    T27. ORDER_ID = T4. ROW_ID (+) AND
    T27. ACCNT_ID = T24. PAR_ROW_ID (+) AND
    T18. PR_DEPOSIT_ID = T21. ROW_ID (+) AND
    T27. BL_ADDR_ID = T9. ADDR_PER_ID (+) AND
    T27. ACCNT_ID = T9. ACCNT_ID (+) AND
    T27. BL_ADDR_ID = T1. ROW_ID (+) AND
    T25. PR_POSTN_ID = T13. POSITION_ID (+) AND
    T25. ROW_ID = T13. OU_EXT_ID (+) AND
    T13. POSITION_ID = T7. ROW_ID (+) AND
    T13. POSITION_ID = T6. PAR_ROW_ID (+) AND
    T6. PR_EMP_ID = T11. PAR_ROW_ID (+) AND
    (T27. INVC_TYPE_CD =: 1) AND
    (T27. DEPT_CD =: 2);


    Explan exit Plan:
    PLAN_TABLE_OUTPUT
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Hash value of plan: 3132260827

    ---------------------------------------------------------------------------------------------------------------------------
    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
    ---------------------------------------------------------------------------------------------------------------------------
    | 0 | SELECT STATEMENT | 1. 1958 | 1896K (11) | 00:50:46 |
    | 1. NESTED EXTERNAL LOOPS | 1. 1958 | 1896K (11) | 00:50:46 |
    | 2. NESTED EXTERNAL LOOPS | 1. 1922 | 1896K (11) | 00:50:46 |
    | 3. NESTED EXTERNAL LOOPS | 1. 1885 | 1896K (11) | 00:50:46 |
    | 4. NESTED EXTERNAL LOOPS | 1. 1861. 1896K (11) | 00:50:46 |
    | 5. NESTED EXTERNAL LOOPS | 1. 1849. 1896K (11) | 00:50:46 |
    | 6. NESTED EXTERNAL LOOPS | 1. 1817 | 1896K (11) | 00:50:46 |
    | 7. NESTED EXTERNAL LOOPS | 1. 1792 | 1896K (11) | 00:50:46 |
    | 8. NESTED EXTERNAL LOOPS | 1. 1771. 1896K (11) | 00:50:46 |
    | 9. NESTED EXTERNAL LOOPS | 1. 1739. 1896K (11) | 00:50:46 |
    | 10. NESTED EXTERNAL LOOPS | 1. 1483. 1896K (11) | 00:50:46 |
    | 11. NESTED EXTERNAL LOOPS | 1. 1451. 1896K (11) | 00:50:46 |
    | 12. NESTED EXTERNAL LOOPS | 1. 1419. 1896K (11) | 00:50:46 |
    | 13. NESTED EXTERNAL LOOPS | 1. 1361. 1896K (11) | 00:50:46 |
    | 14. NESTED EXTERNAL LOOPS | 1. 1276 | 1896K (11) | 00:50:46 |
    | 15. NESTED EXTERNAL LOOPS | 1. 1202 | 1896K (11) | 00:50:46 |
    | 16. NESTED EXTERNAL LOOPS | 1. 1108 | 1896K (11) | 00:50:46 |
    | 17. NESTED EXTERNAL LOOPS | 1. 1087 | 1896K (11) | 00:50:46 |
    | 18. NESTED EXTERNAL LOOPS | 1. 1040 | 1896K (11) | 00:50:46 |
    | 19. NESTED EXTERNAL LOOPS | 1. 939 | 1896K (11) | 00:50:46 |
    | 20. NESTED EXTERNAL LOOPS | 1. 894. 1896K (11) | 00:50:46 |
    | 21. NESTED EXTERNAL LOOPS | 1. 868. 1896K (11) | 00:50:46 |
    | 22. NESTED EXTERNAL LOOPS | 1. 843. 1896K (11) | 00:50:46 |
    | 23. NESTED EXTERNAL LOOPS | 1. 824. 1896K (11) | 00:50:46 |
    | 24. NESTED EXTERNAL LOOPS | 1. 690. 1896K (11) | 00:50:46 |
    | 25. NESTED EXTERNAL LOOPS | 1. 613. 1896K (11) | 00:50:46 |
    | 26. NESTED EXTERNAL LOOPS | 1. 457. 1896K (11) | 00:50:46 |
    | * 27. TABLE ACCESS FULL | S_INVOICE | 1. 269. 1896K (11) | 00:50:46 |
    | 28. TABLE ACCESS BY INDEX ROWID | S_PROJ | 1. 188. 1 (0) | 00:00:01 |
    | * 29. INDEX UNIQUE SCAN | S_PROJ_P1 | 1 | | 1 (0) | 00:00:01 |
    | 30. TABLE ACCESS BY INDEX ROWID | S_PAYMENT_TERM | 1. 156. 1 (0) | 00:00:01 |
    | * 31. INDEX UNIQUE SCAN | S_PAYMENT_TERM_P1 | 1 | | 1 (0) | 00:00:01 |
    | 32. TABLE ACCESS BY INDEX ROWID | S_INSCLM_ELMNT | 1. 77. 1 (0) | 00:00:01 |
    | * 33 | INDEX UNIQUE SCAN | S_INSCLM_ELMNT_P1 | 1 | | 1 (0) | 00:00:01 |
    | 34. TABLE ACCESS BY INDEX ROWID | S_INS_CLAIM | 1. 134. 1 (0) | 00:00:01 |
    | * 35 | INDEX UNIQUE SCAN | S_INS_CLAIM_P1 | 1 | | 1 (0) | 00:00:01 |
    | 36. TABLE ACCESS BY INDEX ROWID | S_PERIOD | 1. 19. 1 (0) | 00:00:01 |
    | * 37 | INDEX UNIQUE SCAN | S_PERIOD_P1 | 1 | | 1 (0) | 00:00:01 |
    | 38. TABLE ACCESS BY INDEX ROWID | S_USER | 1. 25. 2 (0) | 00:00:01 |
    | * 39 | INDEX UNIQUE SCAN | S_USER_U2 | 1 | | 1 (0) | 00:00:01 |
    | 40. TABLE ACCESS BY INDEX ROWID | S_ORDER_TNTX | 1. 26. 2 (0) | 00:00:01 |
    | * 41. INDEX UNIQUE SCAN | S_ORDER_TNTX_P1 | 1 | | 1 (0) | 00:00:01 |
    | 42. TABLE ACCESS BY INDEX ROWID | S_DEPOSIT_TNT | 1. 45. 1 (0) | 00:00:01 |
    | * 43. INDEX UNIQUE SCAN | S_DEPOSIT_TNT_P1 | 1 | | 1 (0) | 00:00:01 |
    | 44. TABLE ACCESS BY INDEX ROWID | S_ORDER | 1. 101 | 2 (0) | 00:00:01 |
    | * 45 | INDEX UNIQUE SCAN | S_ORDER_P1 | 1 | | 1 (0) | 00:00:01 |
    | 46. TABLE ACCESS BY INDEX ROWID | S_INVLOC | 1. 47. 1 (0) | 00:00:01 |
    | * 47 | INDEX UNIQUE SCAN | S_INVLOC_P1 | 1 | | 1 (0) | 00:00:01 |
    | 48. TABLE ACCESS BY INDEX ROWID | S_DOC_QUOTE | 1. 21. 1 (0) | 00:00:01 |
    | * 49 | INDEX UNIQUE SCAN | S_DOC_QUOTE_P1 | 1 | | 1 (0) | 00:00:01 |
    | 50. TABLE ACCESS BY INDEX ROWID | S_ORG_EXT_TNTX | 1. 94. 1 (0) | 00:00:01 |
    | * 51 | INDEX RANGE SCAN | S_ORG_EXT_TNTX_U1 | 1 | | 1 (0) | 00:00:01 |
    | 52. TABLE ACCESS BY INDEX ROWID | S_PTY_PAY_PRFL | 1. 74. 1 (0) | 00:00:01 |
    | * 53 | INDEX UNIQUE SCAN | S_PTY_PAY_PRFL_P1 | 1 | | 1 (0) | 00:00:01 |
    | 54. TABLE ACCESS BY INDEX ROWID | S_ADDR_PER | 1. 85. 2 (0) | 00:00:01 |
    | * 55 | INDEX UNIQUE SCAN | S_ADDR_PER_P1 | 1 | | 1 (0) | 00:00:01 |
    | 56. TABLE ACCESS BY INDEX ROWID | S_ADDR_PER | 1. 58. 1 (0) | 00:00:01 |
    | * 57 | INDEX UNIQUE SCAN | S_ADDR_PER_P1 | 1 | | 1 (0) | 00:00:01 |
    | 58. TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1. 32. 1 (0) | 00:00:01 |
    | * 59 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0) | 00:00:01 |
    | 60. TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1. 32. 1 (0) | 00:00:01 |
    | * 61. INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0) | 00:00:01 |
    | 62. TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1. 256. 2 (0) | 00:00:01 |
    | * 63. INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0) | 00:00:01 |
    | 64. TABLE ACCESS BY INDEX ROWID | S_ACCNT_POSTN | 1. 32. 3 (0) | 00:00:01 |
    | * 65 | INDEX RANGE SCAN | S_ACCNT_POSTN_U1 | 1 | | 2 (0) | 00:00:01 |
    | 66. TABLE ACCESS BY INDEX ROWID | S_POSTN | 1. 21. 1 (0) | 00:00:01 |
    | * 67. INDEX UNIQUE SCAN | S_POSTN_U2 | 1 | | 1 (0) | 00:00:01 |
    | 68. TABLE ACCESS BY INDEX ROWID | S_USER | 1. 25. 2 (0) | 00:00:01 |
    | * 69 | INDEX UNIQUE SCAN | S_USER_U2 | 1 | | 1 (0) | 00:00:01 |
    | 70. TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1. 32. 2 (0) | 00:00:01 |
    | * 71 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0) | 00:00:01 |
    | * 72 | INDEX UNIQUE SCAN | S_PARTY_P1 | 1. 12. 1 (0) | 00:00:01 |
    | 73. TABLE ACCESS BY INDEX ROWID | S_ASSET | 1. 24. 2 (0) | 00:00:01 |
    | * 74 | INDEX UNIQUE SCAN | S_ASSET_P1 | 1 | | 2 (0) | 00:00:01 |
    | 75. TABLE ACCESS BY INDEX ROWID | S_ORG_EXT_X | 1. 37. 2 (0) | 00:00:01 |
    | * 76 | INDEX RANGE SCAN | S_ORG_EXT_X_U1 | 1 | | 2 (0) | 00:00:01 |
    | 77. TABLE ACCESS BY INDEX ROWID | S_CON_ADDR | 1. 36. 3 (0) | 00:00:01 |
    | * 78 | INDEX RANGE SCAN | S_CON_ADDR_U1 | 1 | | 2 (0) | 00:00:01 |
    ---------------------------------------------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):
    ---------------------------------------------------

    27 - filter("T27".") DEPT_CD "=: 2 AND"T27"". "" INVC_TYPE_CD "(=:1)"
    29 - access("T27".") PROJ_ID '= 'T8'.' ROW_ID "(+))"
    31 - access("T27".") PAYMENT_TERM_ID "="T23"." ROW_ID "(+))"
    33 - access("T27".") ELEMENT_ID "="T26"." ROW_ID "(+))"
    35 - access("T26".") INSCLM_ID "="T14"." ROW_ID "(+))"
    37 - access("T27".") BL_PERIOD_ID '= 'T20'.' ROW_ID "(+))"
    39 - access("T27".") LAST_UPD_BY "="T15"." PAR_ROW_ID "(+))"
    41 - access("T27".") ORDER_ID "="T18"." ROW_ID "(+))"
    43 - access("T18".") PR_DEPOSIT_ID "="T21"." ROW_ID "(+))"
    45 - access("T27".") ORDER_ID "="T4"." ROW_ID "(+))"
    47 - access("T4".") SRC_INVLOC_ID '= 'T3'.' ROW_ID "(+))"
    49 - access("T4".") QUOTE_ID "="T12"." ROW_ID "(+))"
    51 - access("T12".") BU_ID "="T19"." PAR_ROW_ID "(+))"
    53 - access("T27".") PER_PAY_PRFL_ID '= 'T2'.' ROW_ID "(+))"
    55 - access("T27".") BL_ADDR_ID '= 'T1'.' ROW_ID "(+))"
    57 - access("T27".") BL_ADDR_ID '= 'T22'.' ROW_ID "(+))"
    59 - access("T8".") BU_ID '= 'T5'.' PAR_ROW_ID "(+))"
    61 - access("T27".") REMIT_ORG_EXT_ID '= 'T16'.' PAR_ROW_ID "(+))"
    63 - access("T27".") ACCNT_ID '= 'T25'.' PAR_ROW_ID "(+))"
    65 - access("T25".") ROW_ID "= 'T13'." OU_EXT_ID "(+) AND 'T25'." ' PR_POSTN_ID '= "T13". "POSITION_ID" (+)) "
    67 - access("T13".") POSITION_ID "="T6"." PAR_ROW_ID "(+))"
    69 - access("T6".") PR_EMP_ID '= 'T11'.' PAR_ROW_ID "(+))"
    71 - access("T25".") BU_ID '= 'T10'.' PAR_ROW_ID "(+))"
    72 - access("T13".") POSITION_ID '= 'T7'.' ROW_ID "(+))"
    74 - access("T3".") CG_ASSSET_ID "="T17"." ROW_ID "(+))"
    76 - access("T27".") ACCNT_ID '= 'T24'.' PAR_ROW_ID "(+))"
    78 - access("T27".") BL_ADDR_ID "="T9"." ADDR_PER_ID "(+) AND 'T27'." "ACCNT_ID"= "T9". "ACCNT_ID" (+)) "
    filter ("T27". "ACCNT_ID"= "T9"." ACCNT_ID "(+))"

    117 selected lines.

    We use 10.2.0.3 oracle version.

    Hello

    According to the plan of the explain command, > 99% of the cost of the query comes from a single operation - step 27, a comprehensive analysis of the S_INVOICE table.
    This probably means that there is no index can be used on DEPT_CD and/or INVC_TYPE_CD.

    So start by setting SELECT * FROM S_INVOICE WHERE ("T27" T27. "DEPT_CD" =: 2 AND "T27" "." " INVC_TYPE_CD "(=:1)"

    BTW the plan shows that the 1 row should be returned, while Oracle actually returns 117 - this means that the optimizer estimates are not very reliable here.

    Best regards
    Nikolai

  • Outer join problem? test code included

    Hi all

    I have three tables:
    Master: It's the program_codes, titles and the active indicator.
    Main: Is the 'information sections"on a specific program.
    ModeOfS: He intones the sections of main program (abstract e.t.c) full-time part-time (PT) or (FT).

    They have all of the effective dates so when he ran during a given year knows whose registration was effective on this year here.
    When I run for 2003 I get 4 records which is correct, but when I run for 2002, I have only 2 folders. There is no valid records in the 'ModeOfS' table, but there are three records in the table of the 'hand' that are valid. But missing registration of P1 of the table of the 'hand '.

    I have external-joined the main table so I don't see why it doesn't show up. Any help would be great.

    Basically, program information may be considered at the level of "ModeOfS" but should not be, it's that his different text. So if it does and it is in the selected year then I want to see it. The limits of two YEARS will always be the same thing that this query will run for one YEAR

    Hello

    oraCraft wrote:
    Hi all

    I have three tables:
    Master: It's the program_codes, titles and the active indicator.
    Main: Is the 'information sections"on a specific program.
    ModeOfS: He intones the sections of main program (abstract e.t.c) full-time part-time (PT) or (FT).

    They have all application dates

    I'm confused. In the sample data you posted, it seems that only 2 tables have dates of application. Did you post erroneous data, at least for the master by mistake?

    so when he ran during a given year knows whose registration was effective on this year here.
    When I run for 2003 I get 4 records which is correct, but when I run for 2002, I have only 2 folders. There is no valid records in the 'ModeOfS' table, but there are three records in the table of the 'hand' that are valid. But missing registration of P1 of the table of the 'hand '.

    What are the correct results for 2002? They are:

    PROG TITLE         A ID PROG TERM_EFF   SECTION      TEXT               FK MO TERM_EFF   SECTION  TEXT
    ---- ------------- - -- ---- ---------- ------------ ----------------------- -- -- ---------- -------- -------------------
    0862 Mechanics     Y P1 0862       2000 ABSTRACT     This is Data
    0862 Mechanics     Y P2 0862       2000 OBJECTIVE    This is Data
    0862 Mechanics     Y P3 0862       2000 PREREQUISITE This is Data
    

    I have external-joined the main table so I don't see why it doesn't show up. ...

    One of the conditions involving modeofs is an outer join:

    ...  and main.ID = modeOfS.FK_ID(+)
    

    but the other is not:

    ...   and nvl(modeofs.TERM_EFF, 9999) = ( select nvl(max(m2.TERM_EFF), 9999)
    from modeofs m2
    where m2.TERM_EFF     <= 2003
    and m2.SECTION       = modeofs.SECTION
    and m2.MODE_OF_STUDY = modeofs.MODE_OF_STUDY)                           
    

    When you use the old notation to join, if no table of x is always marked with a + sign (as in condition 1 above), then all the conditions involving the x table must have a + sign, otherwise the effect will be an inner join. If you find this confusing, you're not alone. It is one of the reasons why I prefer the ANSI join rating:

    with     ranked_main     as
    (
         select     main.*
         ,     rank () over ( partition by  SECTION
                               order by          TERM_EFF     desc     nulls last
                        )           as MAIN_RANK
         from     main
         where     TERM_EFF     <= :target_year
         or     TERM_EFF     is null
    )
    ,     ranked_modeofs     AS
    (
         SELECT     modeofs.*
         ,     rank () over ( partition by  SECTION
                               ,          MODE_OF_STUDY
                               order by          TERM_EFF     desc     nulls last
                        )           as MODEOFS_RANK
         FROM     modeofs
         WHERE     TERM_EFF     <= :target_year
         OR     TERM_EFF     is null
    )
    select      master.*
    ,       ranked_main.*
    ,       ranked_modeOfS.*
    from           master
    join            ranked_main          on   ranked_main.PROGRAM_CODE     = master.PROGRAM_CODE
                           and     ranked_main.MAIN_RANK              = 1
    left outer join  ranked_modeOfS        on     ranked_modeofs.FK_ID          = ranked_main.ID
                                    and     ranked_modeofs.MODEOFS_RANK        = 1
    ;
    
  • Problem with XMLTABLE and LEFT OUTER JOIN

    Hi all.

    I have a problem with XMLTABLE and LEFT OUTER JOIN, in 11g it returns the correct result, but in 10g it doesn't, it is illustrated as a 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          
    This is all nice, 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     g4
    As you can see in 10g that I don't have the last row, it seems that Oracle 10 g does not 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 results returned, just incorrect.

    Help, please.

    Kind regards.

    What about try the original Oracle method for outer joins? Using (+) without the extra space

    XMLTABLE(...COLUMNS ... id XMLTYPE PATH ... ) x,
    XMLTABLE(... PASSING x.id ...) (+) y
    
  • outer join and LignesMax problem left

    I'm having a problem with the method and an sql join. My left table includes some documents that I want in the list, max 25 per page. These records have some notes are related in another table that is outer joined. When I specify the method in my cfoutput tag it includes my external joined table rows. So I could only go 5 records in my table left and 20 of my attachment table. What I want is 25 records in my table on the left and however the number of records in the table on the other that could be associated with these 25 records. Is this possible?

    I make two requests and avoid the outer join in this case:

  • Problem with Outer join and filter

    Hello

    I join two tables in the source using a left outer join. Outside of the join, I have a filter specified with condition TabA.C1 > TabB.C2.

    Now, when ODI generates the query it puts the left outer join on the filter condition as well. So he puts filter as

    where
    (1 = 1)
    And ((TabA.C1 = TabB.C1 (+)) AND)
    (TabA.C2 = TabB.C2 (+))
    And TabA.C10 > TabB.C14 (+)

    How to avoid this problem. I tried this performance on stage as well, always generated query remains the same.

    I use the incremental update of the IKM Oracle. My source and target are both on the same PB.


    ~ Chikk

    Hi Chikk,

    If you analyze the data, you'll see it's OK to have the "(+)" to the filter...

    Anyway, if you want to drop it, leave it as inner join and put the "(+)" manually to the join object.

    This help you?

  • Problem with the implementation of Outer JOIN

    Hello Guru,

    Here's my scenario. I know that this can be achieved in several ways. But I need this in a single in aid Of JOINS EXTERNALrequest.

    I have two tables namely masters and transactions table. I need to join two columns (trx_name, trx_type) of the two tables and the need for all transactions. Part the trickiest is off 2 join columns, one column can be NULL in the main table.

    Script TABLES:

    create master table (mstr_no number, trx_name varchar2 (100), trx_type varchar2 (100), trx_module varchar2 (100));

    insert into masters values (1, 'yyyy', 'simple', 'cont');
    insert into masters values (2, 'bbbb', < NULL >, "cust");
    insert into masters values (3, 'yyyy', 'triple', "cont1");

    create table transaction (trx_no number, trx_name varchar2 (100), trx_type varchar2 (100));

    Insert in transaction values (1, 'yyyy', 'simple');
    Insert the transaction values (2, 'bbbb', 'double');
    Insert in transaction values (3, 'yyyy', 'triple');
    Insert in transaction values (4, 'cccc', 'purple');
    commit;

    I need output like below.

    1, 'yyyy', 'simple', 'cont '.
    2, 'bbbb', < NULL >, * "cust."
    3, 'yyyy', 'triple', "cont1".
    4, 'cccc', 'purple', < NULL >

    I need to join trx_name & trx_type in the two tables. Even if one of the column is null in the main table (mstr_no = 2), I have need of the corresponding value of trx_module since trx_name made match.


    My query:
    Select a.*, b.trx_module of transaction a, master b
    where a.trx_name = b.trx_name (+)
    and a.trx_type = NVL (b.trx_type (+), 'NULL')
    order of a.trx_no

    Appreciate your help.


    Concerning
    MN

    Maybe I'm wrong, but I don't think you can do this with a single outer join:

    with
    full_matches as (
    select *
      from master
     where trx_type is not null)
    ,
    partial_matches as (
    select *
      from master
     where trx_type is null)
    select a.*
         , coalesce(b.trx_module, c.trx_module) trx_module
      from transaction a
      left outer join full_matches b
        on (a.trx_name = b.trx_name and a.trx_type = b.trx_type)
      left outer join partial_matches c
        on (a.trx_name = c.trx_name)
     ;
    
    TRX_NO TRX_NAME             TRX_TYPE             TRX_MODULE
    ------ -------------------- -------------------- ------------
         1 aaaa                 single               cont
         3 aaaa                 triple               cont1
         2 bbbb                 double               cust
         4 cccc                 purple
    

    Re-reading my answer, I see that a short explanation might be useful: the query uses two outer joins: first masters lines with the name and type are joined, and then type the lines with missing. Him coalesce work to choose the most relevant information of module.

    Published by: Martin Preiss on June 7, 2013 20:24

  • Problem with LEFT OUTER JOIN

    Hello

    I am in charge of the migration of a SQL Server 2000 database to Oracle 11 g, under what I also migrate some predefined queries, that my client has. However I can't seem to get the syntax right and it keeps failing. Could you please help me? Thank you.

    Query:
    SELECT *,(select r.recsolins from gx.repara r where r.percod=c.percod and r.concod=c.concod and r.rectpo='I' and r.recsts='F' and r.grppercod=10 and r.recnro=(select max(t.recnro) from gx.repara t where t.percod=c.percod and t.concod=c.concod and t.rectpo='I' andt.recsts='F' ) ) as NROID
    FROM gx.CONABO c, gx.abonad a  
    LEFT OUTER JOIN gx.CALLES y ON  y.dptocod=10 and y.ciucod=524 and y.CALCOD=A.AboCalEsq1, 
    LEFT OUTER JOIN gx.CALLES Z ON  z.dptocod=10 and z.ciucod=524 and z.CALCOD=A.AboCalEsq2 
    ,gx.calles x WHERE c.PERCOD in (10,60) and CONSTSHAB in ('C','D','P')
    and a.percod=c.percod and a.abocod=c.abocod and
    x.dptocod=10 and x.ciucod=524
    and x.calcod=abocal
    order by c.percod,c.concod;
    The fields are correct, but I get not found when expected in FROM clause.

    Published by: n on June 5, 2012 13:47
  • Problem with ANSI OUTER JOIN

    Hi all

    I have issues with the help of ANSI LEFT JOIN compared to Oracle (+). Below test I did the same thing.
          create table emp (emp_id number(10), emp_name varchar2(50));
          create table courses (course_id number(10), emp_id number(10), course_name varchar2(50));
          
          INSERT INTO EMP values(1,'A');
          INSERT INTO EMP values(2,'B');
          INSERT INTO EMP values(3,'C');
    
          INSERT INTO COURSES values(1,1,'ORACLE');
          INSERT INTO COURSES values(2,1,'JAVA');
          INSERT INTO COURSES values(3,3,'C#');
    
          --*Query 1
          SELECT a.*, b.*
          FROM EMP a  LEFT JOIN COURSES b 
          ON a.emp_id = b.emp_id
          AND a.emp_name = 'A'
    
          --*Query 2      
          SELECT a.*, b.* 
          FROM EMP a, COURSES b 
          where a.emp_id = b.emp_id(+)
          and a.emp_name = 'A'
    Here Query1 return all records of 4 same records regardless of emp_name = 'A' where as Query2 returns 2 records of ep_name = 'A' which is correct.

    Is this correct? I'm confused if you use the standard ANSI OUTER JOINS or not.

    I am using Oracle 11g

    Thank you.

    Change your AND WHERE, in the style of ANSI, select:

    SELECT a.*, b.*
    FROM EMP a  LEFT JOIN COURSES b
    ON a.emp_id = b.emp_id
    WHERE a.emp_name = 'A'
    

    Filters in the clause are those who use the (+) in the Oracle syntax.
    Filters WITHOUT (+) in the Oracle syntax should be in the WHERE clause using the ANSI syntax.

    Published by: Kim Berg Hansen on September 23, 2011 08:03

  • LEFT OUTER JOIN, trigger after QUERY problem

    Hello

    Guide to please the following

    I wrote under query in QUERY after a BLOCK of TABULAR DATA, not as a single text element, called INVENTORY_ITEM

    Select c.cat |' '|| s.SubCat |' '|| L1.lvl1 POINT IN: DATABLOCK. INVENTORY_ITEM
    of itemcat c
    LEFT OUTER JOIN itemsubcat s on (c.catid = s.catid)
    LEFT OUTER JOIN lvl1 l1 on (s.subcatid = l1.subcatid)

    When I compile the module an error is generated

    «* ' Met the 'LEFT' symbol when waiting for one of the following values for the group with intersect less order start union where connect '.» *

    Top query works fine with ORACLE SQL DEVELOPER.

    Any solution please.

    Kind regards

    Difference

  • Problem format (LEFT OUTER JOIN)?

    THE addresses of Mutiple of return as a single record + current addresses

    >
    Hi all

    I have to back student addresses home and dormitory under a single registration.

    He had to go something like this:
    LAST_NAME     FIRST_NAME     ADDY_TYPE   ADDRESS             ZIP
    Smith                John             HOME         123 Awesome St     10003
    Smith               John               DORM         Oak Quad             10013
    In this format the desired:
    LAST_NAME  FIRST_NAME     ADDY_TYPE  ADDRESS         ZIP        ADDY_TYPE     ADDRESS     ZIP
    Smith            John      HOME        123 Awesome St  10003   DORM            Oak Quad     10013
    You also need to get their last addresses by date.
    The database hold records of all students have places moving from dorm to dorm
    and some permanent residence ("HOME") has changed as well.
    To return only a DORM address and only a HOME address
    for each student.

    I'm looking at possibly a function BOX to put on a line/record and RANK BY() or DENSE_RANK to determine the last addresses.

    Hope I'm making some sense and as always very grateful for any help. Thank you.
    >

    The correct code provided by Frank Kulash here:
    WITH    got_rnum     AS
    (
         SELECT     last_name
         ,     first_name
         ,     addy_type
         ,     address
         ,     zip
         ,     ROW_NUMBER () OVER ( PARTITION BY  last_name
                                   ,                    first_name
                             ,             addy_type
                             ORDER BY        addy_date     DESC     NULLS LAST
                           ) AS rnum
         FROM    table_x
    --     WHERE     ...          -- Any filtering goes here
    )
    SELECT    last_name
    ,       first_name
    ,       MIN (CASE WHEN addy_type = 'HOME' THEN address END)     AS home_address
    ,       MIN (CASE WHEN addy_type = 'HOME' THEN zip     END)     AS home_zip
    ,       MIN (CASE WHEN addy_type = 'DORM' THEN address END)     AS dorm_address
    ,       MIN (CASE WHEN addy_type = 'DORM' THEN zip     END)     AS dorm_zip
    FROM       got_rnum
    WHERE       rnum     = 1
    GROUP BY  last_name
    ,            first_name
    ;
    I need to add a 'NATION' field, located on another table for the addresses of welcome for foreign students.
    I made a LEFT OUTER JOIN with the table of the NATION and the release came out like this:
    LAST_NAME  FIRST_NAME     ADDY_TYPE  ADDRESS   ZIP      NATION    ADDY_TYPE       ADDRESS     ZIP
    Smith            John      HOME        Rue Henry M1V 4F4  CANADA      null              null             null
    Smith            John      null        null      null     null        DORM               Oak Quad     10013
    My desired output would be like this:
    LAST_NAME  FIRST_NAME     ADDY_TYPE  ADDRESS   ZIP      NATION    ADDY_TYPE       ADDRESS     ZIP
    Smith            John      HOME        Rue Henry M1V 4F4  CANADA    DORM              Oak Quad     10013
    Maybe it's something I'm not right. What is the way I'm joining tables?

    As always very grateful for your contributions. Thank you.

    Give a glance to your group by, you group on the nation, but it has two values (NULL and CANADA). Try this way:

    WITH    got_rnum     AS
    (
         SELECT     STUINFO_id
      , STUINFO_last_name
         ,     STUINFO_first_name
         ,     ADDRESSLIST_atyp_code
         ,     ADDRESSLIST_street_line1
      , ADDRESSLIST_street_line2
      , ADDRESSLIST_city
      , ADDRESSLIST_stat_code
         ,     ADDRESSLIST_zip
    
    , ADDRESSLIST_natn_code
    , NATION_nation
         ,     ROW_NUMBER () OVER ( PARTITION BY  STUINFO_last_name
                                   ,                    STUINFO_first_name
                             ,                         ADDRESSLIST_atyp_code
    
                             ORDER BY        ADDRESSLIST_from_date     DESC     NULLS LAST
                           ) AS rnum
         FROM STUINFO JOIN CLASSROSTER ON STUINFO_pidm = CLASSROSTER_pidm JOIN ADDRESSLIST ON ADDRESSLIST_pidm = STUINFO_pidm LEFT OUTER JOIN NATION ON ADDRESSLIST_NATN_CODE =NATION_CODE
    -- The WHERE part determines if the student is currently enrolled in a class
    -- ADDRESSLIST_to_date is the last date the student will be living in that residence
    WHERE ADDRESSLIST_atyp_code IN ('PR', 'CA') and  STUINFO_change_ind IS NULL and STUINFO_last_name !='Registrar'
    and CLASSROSTER_term_code='200909' and CLASSROSTER_PTRM_CODE IN ('D', 'D1', 'D2') and CLASSROSTER_CAMP_CODE='1'
    
    and (ADDRESSLIST_to_date is NULL OR ADDRESSLIST_TO_DATE > SYSDATE)
    )
    SELECT    STUINFO_id
    ,   STUINFO_last_name
    ,       STUINFO_first_name
    ,       MIN (CASE WHEN ADDRESSLIST_atyp_code = 'PR' THEN ADDRESSLIST_STREET_LINE1  END)     AS PR_ADDRESSLIST_STREET_LINE1
    ,       MIN (CASE WHEN ADDRESSLIST_atyp_code = 'PR' THEN ADDRESSLIST_STREET_LINE2  END)     AS PR_ADDRESSLIST_STREET_LINE2
    ,       MIN (CASE WHEN ADDRESSLIST_atyp_code = 'PR' THEN ADDRESSLIST_city     END)     AS PR_ADDRESSLIST_city
    ,       MIN (CASE WHEN ADDRESSLIST_atyp_code = 'PR' THEN ADDRESSLIST_stat_code     END)     AS PR_ADDRESSLIST_stat_code
    ,       MIN (CASE WHEN ADDRESSLIST_atyp_code = 'PR' THEN ADDRESSLIST_zip     END)     AS PR_ADDRESSLIST_zip
    ,       MIN (CASE WHEN ADDRESSLIST_natn_code IS  NULL THEN ADDRESSLIST_natn_code     END)     AS PR_ADDRESSLIST_natn_code
    , MIN(NATION_nation) NATION_nation
    ,       MIN (CASE WHEN ADDRESSLIST_atyp_code = 'CA' THEN ADDRESSLIST_STREET_LINE1  END)     AS CA_ADDRESSLIST_STREET_LINE1
    ,       MIN (CASE WHEN ADDRESSLIST_atyp_code = 'CA' THEN ADDRESSLIST_STREET_LINE2  END)     AS CA_ADDRESSLIST_STREET_LINE2
    ,       MIN (CASE WHEN ADDRESSLIST_atyp_code = 'CA' THEN ADDRESSLIST_city     END)     AS CA_ADDRESSLIST_city
    ,       MIN (CASE WHEN ADDRESSLIST_atyp_code = 'CA' THEN ADDRESSLIST_stat_code     END)     AS CA_ADDRESSLIST_stat_code
    ,       MIN (CASE WHEN ADDRESSLIST_atyp_code = 'CA' THEN ADDRESSLIST_zip     END)     AS CA_ADDRESSLIST_zip
    
    FROM       got_rnum
    WHERE       rnum     = 1
    GROUP BY  STUINFO_last_name
    ,            STUINFO_first_name
    ,         STUINFO_id
    ORDER BY STUINFO_last_name;
    

    Max

  • SSRS for lack of outer join with the Oracle data source

    It seems to be a problem with the Oracle driver used in the Reporting SERVICES query designer.

    When you use an Oracle data source, if I create an outer join in the graphic designer, it automatically inserts '{OJ' before the join and '} ' after her.  This is an incorrect syntax for Oracle and refuses to start.  The curly braces and the JO editable in designer text, but if I go back to the graphic designer and immediately to reintegrate them.

    Only, this has started to happen a year or two ago - before that it worked, but with the old (+) syntax.

    Can it not be healed?  It makes things very difficult.

    -Geoff

    Hi Geoff,

    Thanks for posting in the Microsoft Community.

    However, the question you posted would be better suited in the Forums of the Oracle Support; We recommend that you post your query in Oracle Support Forums to get help:

    https://forums.Oracle.com/forums/main.jspa;JSESSIONID=8d92100c30d8fb401bcbd10b46c38c9ddf1a3242549a.e34SbxmSbNyKai0Lc3mPbhmSc3aNe0? CategoryID = 84

    If you have any other questions or you need Windows guru, do not hesitate to post your questions and we will be happy to help you.

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

Maybe you are looking for

  • Clear history does not

    Usually I ctrl + shift + delete to clear my history/cookies/etc, or on the rare occasion I'll click in the drop-down box. When I tried to erase my histroy today, the box with the options to clear the history didn't pop up.

  • Satellite U920T - battery short time after 2 years of use of work

    Hi all My 2 years old computer U920t laptop / Tablet satellite ultrabook has bad battery life. The battery will only last up to 2 hours before requiring charging on the basis of data entry doc/excel word normal. Any ideas on how I can improve it? The

  • Satellite Pro L300 - 1FJ PSLB9E enters mode "sleep" instead of power

    Hi all... I have a laptop Toshiba Satellite L300-1AF, and I noticed this issue only recently. It works and everything it ok it runs Windows XP Pro SP3 and works normally, however when I stopped it closes down and runs out of windows and the amber sta

  • "27049 internal error" when you use recovery with Equium A60-692 utility

    TOSHIBA SATELLITE A60 - 692 I'm trying to fix a friends laptop. The laptop computer wouldnâ? t start, would go to the blue screen just before the came WinXP loading screen then will re-start. I used a USB 2.5 HDD enclosure "to copy important files on

  • Slow shutter

    Having got my head around lighting S & Q and full scan and change of format to XAVC then I though I was clear on the block of rate options... but there are also slow shutter setting? Number of images SLS? What...Please can someone explain never seen