FULL JOIN PROBLEM

Hi Experts,

My version of the database is Oracle9i Enterprise Edition Release 9.2.0.1.0

This is the date of the sample

create table bill_coll (doc_date date, fees_id number, coll_amt number).

insert into bill_coll values('30-AUG-13',10,2540);

insert into bill_coll values('30-AUG-13',10,5560)
insert into bill_coll values('30-AUG-13',10,3000)
insert into bill_coll values('30-AUG-13',10,3000)

insert into bill_coll values('22-AUG-13',10,6000)
insert into bill_coll values('22-AUG-13',10,4300)

create table bnk_trn (doc_date date, number of trn_amt);

insert into bnk_trn values('22-AUG-13',10300);

insert into bnk_trn values('29-JUN-13',25000);

insert into bnk_trn values('29-JUN-13',5000);

Based on the two tables above, I have to get the comparison bill on data collection and the amount deposited to the Bank.

The below mentioned query is not helped and what gives unexpected output:

Select nvl (a.doc_date, b.doc_date) doc_date, a.coll, b.trn_amt
Of
(select doc_date coll, sum (coll_amt) of the bill_coll in doc_date group) a
full join
b (select doc_date, sum (trn_amt) group bnk_trn by doc_date trn_amt)
by order of a.doc_date = a.doc_date b.doc_date
/

DOC_DATE COLL TRN_AMT
----------------------------------------------

22 AUGUST 13 10300 10300
30 AUGUST 13 11100
29 JUNE 13
29 JUNE 13

Please help me to get an output as follwos:

DOC_DATE COLL TRN_AMT
----------------------------------------------

22 AUGUST 13 10300 10300
30 AUGUST 13 11100
29 JUNE 13 30000

Thanks in advance.

This is perhaps a bug concerning the implementation of the standard ANSI-SQL-join-Systax. (I don't like the alias in the order by clause)

Maybe you can rewrite the statement as below

Select doc_date, sum (coll), sum (trn_amt)

de)

Select doc_date, coll_amt coll, trn_amt null in bill_coll

Union of all the

Select doc_date, null, bnk_trn trn_amt coll

)

Doc_date group

order of doc_date

DOC_DATE SUM(COLL) SUM(TRN_AMT)
22 AUG 13 10300 10300
29 JUNE 13 - 30000
30 AUGUST 13 14100

(the order is not accurate because I used a varchar column not a date column)

Tags: Database

Similar Questions

  • El Capitan is always full of problems?

    Looks like El Capitan's full of problems still? I want to improve, but I'm quite scared!

    What problems are you talking about? I've been running El Capitan for just a short time after that he was released and have no problems, as have many, many other users. So, unless you specify what it is that you are worried, then nobody can possibly provide you with any information.

    See you soon,.

    GB

  • SQL Query Full join is not enough

    Hello

    I have 2 tables of FORECASTING and SALE and to make it easier, I reduced the data and the following columns

    FORECASTS TABLE

    Release of Quantity Material
    R11A
    R13B
    R23B
    R24D

    SALES TABLE

    Material Quantity
    A2
    B3
    C4

    I want to join these two tables to get the following results, getting always each sale for each existing versions even if there is no material in the forecast. And also displaying a material without any sales forecasts.

    Release of Material Forecast Qty. Sales quantity
    R1A12
    R1B33
    R1C04
    R2A32
    R2B03
    R2C04
    R2D40

    There should be some sort of FULL JOIN, but it is not enough...

    Any advice would be very helpful...

    Thanks in advance!

    WITH FORECASTS AS)

    SELECT 'R1' release, 1 quantity, "A" DOUBLE material

    UNION ALL SELECT 'R1', 3, 'B' OF THE DOUBLE

    UNION SELECT ALL 'R2', 3, 'B' OF THE DOUBLE

    SELECT ALL 'R2' UNION, 4, WOULD BE "OF THE DOUBLE

    )

    () AS SALES

    SELECT "A" material, quantity 2 FROM DUAL

    SELECT ALL 'B', 3 DOUBLE UNION

    UNION SELECT ALL 'C', 4 DOUBLE

    )

    Select FORECAST.release

    sales. Material

    NVL (FORECAST. Amount, 0)

    sales. Quantity

    Since the partition of sales of right join (release) on FORECASTS FORECASTS. Material = sales. Material

    UNION ALL

    Select FORECAST.release

    PREDICTION. Material

    PREDICTION. Quantity

    0

    Since the partition of left join (release) on FORECASTS sales FORECASTS. Material = sales. Material

    Sales WHERE. Material IS NULL

    ;

  • How to use "full join" in ODI interface

    I need to join two tables using full join. Then, when I do drag table columns (join build) and mark the left and right join (get full join):
    + (All lines of OSS_NCELLREL (OSS_NCELLREL), including the lines not matched with lines of OSS_NECELASS (OSS_NECELASS) and all lines of OSS_NECELASS (OSS_NECELASS) including the lines not matched with OSS_NCELLREL (OSS_NCELLREL) +)
    I get the following error:
    The source of the diagram Panel: Clause set to join full on a technology that does not support full joins

    I use Oracle DB tables in the same PB.

    Help! What I've done wrong?

    Hello

    You need work in the topology Manager.

    Please follow the steps below

    1. change the 'Oracle' in the tree of the physical Architecture technology.
    2 If ' technology Defintion tab select button radio "Ordered (Sql ISO).
    3. in the "SQL Tab" technology do the following settings:
    -Clause location: of
    -Media supported clauses: check
    -Inside: check, type INNER JOIN
    -Cross: check, type CROSS JOIN
    -Left outside: check, type LEFT OUTER JOIN
    -Right outside: check, type RIGHT OUTER JOIN
    -External more info: check, type FULL OUTER JOIN

    PS: Please take a techno Oracle backup before editing. ;)

    Thank you
    G

    Published by: Gurusank on November 27, 2008 21:05

  • Full storage problems

    My iPhone 6 s guard advising me these last two days that my storage is almost full. With a threat to lock me up on whatsapp (that must be running at least 100 MB), I decided to delete the photos, applications etc off the coast (including the deletion of recently deleted photo and video album). Now, I've deleted almost every thing off my phone, including those that I have used before and my storage space is still telling me that I am using 11.4 GB of space, when before you delete it told me that I was using only 11.0 GB of space. Yesterday I backed up everything to iCloud and reset the content and settings when she returned on storage showed I was using only 3.2.GB my 16 GB phone. But today, I am faced with the same question that my storage is returned up to 11.4 GB without me to add photos, videos or apps on the phone at night. Does anyone else have this problem, how do solve you this problem, is something to do with Apple? Year last December when I bought the phone, I lost a lot of contacts via backup and now this iCloud. What the * happens?

    Suggest you remove WhatsApp, it poses many problems of storage for many users. The last update has a bug and WhapsApp has yet to fix it. Do not re-install it until it is resolved. Good luck.

  • windows 7 windows full screen problem

    I just bought a new hp laptop and it was working fine, then one day when I went to the opening of a program, it is no longer open in full-screen. It opens to a size from the menu bar or the status bar. Then I slide it open or click to maximize. I tried several things to try to open by default with no luck. I tried to open it and now the key Maj and xing out, I have tried f11 and no matter what I do it always goes back to opening of bar. Can you help me.

    Three options.

    1: take the corners of the window and drag it to the format full screen. Do not use to expand. Close all other windows first via the taskbar and the latter.  Windows will remember the size of the last closed window the next time that you open the program.  You will need to do this for each problem one window at a time.

    2: any shortcut you use to launch the window, right-click, and select Properties. Under the 'Run' drop-down list, choose "expanded".

    3: IE New Window Maximizer (for IE only).
    http://www.MajorGeeks.com/IE_New_Window_Maximizer_d1746.html

    Bruce Hagen
    MS - MVP October 1, 2004 ~ September 30, 2010
    Imperial Beach, CA

  • 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
    ;
    
  • Animate CC 2015 Air for iOS full screen problem

    Hello team Adobe,

    I made many applications for iOS and Android. And I am facing 1st time a problem only in the Air for iOS. Air for Android works perfectly well. What I'm dealing with that

    even after using this code:

    internship. Align = StageAlign.TOP_LEFT;

    stage.scaleMode = StageScaleMode.EXACT_FIT;

    I see black bands top & bottom of my application. Then I downloaded the new SDK is Air SDK 21.0 but same problem :/ Please tell me as soon as POSSIBLE, why is that happening?

    Thank you

    Saad

    Hi Saad Aftab,

    I tried with the attached draft you shared.

    If this problem could be solved if you add images to your project.

    Please try the application after giving the images of the launch of the publication. The application will launch in full-screen and there will be no black bands if you have already configured the 'true' parameter in app.xml.

    Please let me know if you face any problem.

    Thank you

    Adobe AIR Team

  • Help with my POS, full disc problem

    my version of POS is 6.0.2 when I ran my backup jobs it had problem.

    Status of the device stopped to "admin" status and refused to go back to the 'normal '.

    "gsan" service has been degraded. From the logs I see it might caused by disk full, but even if I deleted all my restore points, disk space will not be recovered because the status of the device is "admin".

    Here are some of my logs, can anyone help? Thank you very much.

    DF h
    Size of filesystem used Avail use % mounted on
    / dev/sda2 7.9 G 4.8 G 2.8 G 64%.
    udev 3.9 G 136 K 3.9 G 1% / dev
    tmpfs G 3.9 3.9 G 0 0% / dev/shm
    / dev/sda1 130M 38 M 86 M 31% / Boot
    / dev/sda7 1.5 G 121 M 1.3 G 9% / var
    / dev/sda9 77G 4.9 G 68 7% /space
    / dev/sdb1 512G 498 G 15 G 98% /data01
    / dev/sdc1 512G 502 G 11 G 98% /data02
    / dev/sdd1 512G 501 G 12 G 98% /data03

    cplist
    CP.20150808160314 Saturday, August 8 09:03:14 2015 valid rol - strips nodes 1/1 3253
    CP.20150808165046 Saturday, August 8 09:50:46 valid 2015 rol - strips nodes 1/1 3253

    Status.DPN
    Sun Aug 16 19:05:51 PDT 2015 [servername] Mon Aug 17 02:05:51 UTC 2015 (initialized kills Aug 4 05:13:53 UTC 2015)
    Node IP address Version State Runlevel user + Root + Srvr Dis suspend charge UsedMB Errlen % full full and the band by disk status
    MHPU fullaccess 0.0 online 10.192.14.192 7.1.81 - 107 + 0hpu + 1 0000 fake 7590 0.32 2374797 12.1% 12% (onl:1086) 12 %(onl:1084) 12 %(onl:1083)
    Modes user + Root + Srvr = migrate + hfswriteable + persistwriteable + useraccntwriteable

    System ID: 1438665233@00:50:56:AB:4E:38

    All declared states = (ONLINE), = (fullaccess) runlevels, modes (mhpu + 0hpu + 0000)
    The system state: ok
    Access-situation: admin

    Checkpoint failed with the MSG_ERR_DISKFULL result: cp.20150816150216 departure Sun Aug 16 08:02:46 2015 ended the Sun Aug 16 08:02:46 2015, over 0 3253 stripes
    Last GC: finished Sun Aug 16 08:01:46 2015 after 00: 30 > > recovered 0.00 KB (MSG_ERR_DISKFULL)
    No hfscheck still

    Active maintenance windows scheduler capability profile.
    The maintenance window is running.
    Next backup window start time: Sun Aug 16 20:00 PDT 2015
    Start time of next maintenance window: Mon Aug 17 at 08:00 PDT 2015

    status of dpnclt
    Identity added: /home/dpn/.ssh/dpnid (/ home/dpn/.ssh/dpnid)
    dpnctl: INFO: gsan status: gradient
    dpnctl: INFO: status MCS: upward.
    dpnctl: INFO: status of the backup scheduler: upward.
    dpnctl: INFO: axionfs status: upward.
    dpnctl: INFO: status of Maintenance windows scheduler: enabled.
    dpnctl: INFO: starting automatic State: enabled.

    I looks like the control points are taking up all the space assigned to them.  Before that POS remove a checkpoinit, it passes through a process of creation of a post of control and validation of the integrity of the previous control point.  I think that you will need to contact support to resolve the problem.

    That said, it seems that you have deleted all restore points.  If so, it would be easier to erase and start over instead of trying to solve the problem.

  • 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 - 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? 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
    ;
    
  • Complex join, problems

    Hi guys!

    There is a select statement
    WITH t AS (
         SELECT 1 ID FROM dual)
         , t2 AS (
         SELECT 1 ID, 1 acc1 FROM dual UNION ALL
         SELECT 1 ID, 2 FROM dual)     
         , t3 AS (
         SELECT 1 ID, 1 acc2 FROM dual UNION ALL
         SELECT 1 ID, 2 FROM dual UNION ALL
         SELECT 1 ID, 3 FROM dual)          
    SELECT t.ID,
      t2.acc1,
      t3.acc2 
    FROM t, t2, t3
    WHERE t.ID = t2.ID
      AND t.ID = t3.ID     
    the result of this statement:
    id    acc1     acc2
    1     1     1
    1     1     2
    1     1     3
    1     2     1
    1     2     2
    1     2     3
    but I want to get this result:
    id    acc1     acc2
    1     1     1
    1     2     2
    1     null     3
    How could I achieve this?

    Thank you!

    Hi, Pavel,

    Pavel E. says:
    Ok. We will explain on the other hand:

    Please do not explain. Give more examples is good, but it is not the same thing to explain.

    ... Table t is 'main' (Board), tables t2 and t3 - charts of accounts. And I'm still a link t2 and t3 to t. This is why I want to get this result:

    id       acc1       acc2
    ------  -------   ------
    1     1         5
    1     2         6
    1     null         7
    2     3         9
    2       null        10
    3     4           11
    

    Sorry, I don't see why you want the results of these data.

    Why is that not the correct results?

    id       acc1       acc2
    ------  -------   ------
    1     1         6
    1     2         5
    1     null         7
    2     3         9
    2       null        10
    3     4           11
    

    Do you want
    the lowest acc1 joined the acc2 lowest (for the same id).
    the 2nd lowest acc1 joined the 2nd lowest acct
    ...
    the nth lowest acc1 joined the lowest acc2 n - th?
    If so, then you want what I call a Fixed price request . The ROW_NUMBER analytic function allows to assign numbers 1, 2, 3,... for t2 and t3 lines, depends on the question whether this line is the 1st, 2nd, 3rd,... value of CAC more down for each ID use this number (and not on the value brute accc) in the join condition.
    If sometimes niot t2 will have a row of mtching to t3 (but you want to include in any case) and at other times t3 will not have a row in t2 (but you still want to include it) then make the join, outer join full.

  • Normal screen ok fine, but full screen problem

    Screen normal ok fine, but in fullscreen mode scrub bar, red fill is changed places.

    How to solve this problem, I have tired but increased problems.

    function volumeScrubberClicked(e:MouseEvent):void
    {
              bolVolumeScrub = true;
    
    
              rightctrls.mcVolumeScrubber.startDrag(true, new Rectangle(13, -4, 60, 0));
    }
    
    
    function progressScrubberClicked(e:MouseEvent):void
    {
              bolProgressScrub = true;
    
    
              mcProgressScrubber.startDrag(true, new Rectangle(0, 323, 472, 0));
    
    
    }
    
    
    function mouseReleased(e:MouseEvent):void
    {
              bolVolumeScrub= false;
              bolProgressScrub= false;
    
    
              mcProgressScrubber.stopDrag();
              rightctrls.mcVolumeScrubber.stopDrag();
    
    
              videoscrubr.mcProgressFill.mcFillRed.width= mcProgressScrubber.x + 5;
              rightctrls.mcVolumeFill.mcFillRed.width= rightctrls.mcVolumeScrubber.x - 73 + 60;
    
    
              if ((rightctrls.mcVolumeScrubber.x - 13) / 60 > 0)
              {
                        intLastVolume = (rightctrls.mcVolumeScrubber.x - 13) / 60;
              }
    }
    
    
    function updateDisplay(e:TimerEvent):void {
              if(bolProgressScrub)
                        stream.seek(Math.round(mcProgressScrubber.x * objInfo.duration / 472))
              else
                        mcProgressScrubber.x = stream.time * 472 / objInfo.duration; 
    
        
              videoscrubr.mcProgressFill.mcFillRed.width= mcProgressScrubber.x + 5;
              videoscrubr.mcProgressFill.mcFillGrey.width= stream.bytesLoaded * 478 / stream.bytesTotal;
    
    
              if (bolVolumeScrub)
              {
                        setVolume((rightctrls.mcVolumeScrubber.x - 13) / 60);
                        rightctrls.mcVolumeFill.mcFillRed.width = rightctrls.mcVolumeScrubber.x - 73 + 60;
              }
    }
    
       
    function fullscreenOnClicked(e:MouseEvent):void
    {
              stage.displayState = StageDisplayState.FULL_SCREEN;
    }
    
    
    function fullscreenOffClicked(e:MouseEvent):void
    {
              stage.displayState = StageDisplayState.NORMAL;
    }
    
    
    function onFullscreen(e:FullScreenEvent):void
    {
              // bottom center align controls
      
              //mcVideoControls.x = 0;
              var stagewidth:int = int(stage.stageWidth);
      
              mcVideoControls.y = int(stage.stageHeight) - 36;
              mcVideoControls.width = stagewidth;
    
    
              videoscrubr.width = stagewidth;
              videoscrubr.x = stagewidth / 2;
              videoscrubr.y = int(stage.stageHeight) - 30;
    
    
              //mcProgressScrubber.width = stage.stageWidth;
              mcProgressScrubber.y = stage.stageHeight - 35;
    
    
              playctrls.x = 28;
              playctrls.y = stage.stageHeight - 14;
    
    
              rightctrls.x = stage.stageWidth - 123.2;
              rightctrls.y = stage.stageHeight - 14.25;
    
    
              btnMidPlay.x = stage.stageWidth / 2;
              btnMidPlay.y = stage.stageHeight / 2;
    
    
              if (e.fullScreen)
              {
                        // switch fullscreen buttons
                        rightctrls.btnFullscreenOn.visible = false;
                        rightctrls.btnFullscreenOff.visible = true;
    
    
                        vidDisplay.height = (Capabilities.screenResolutionY);
                        vidDisplay.width = vidDisplay.height * 4 / 3;
                        vidDisplay.x= (Capabilities.screenResolutionX - vidDisplay.width) / 2;
              }
              else
              {
                        // switch fullscreen buttons
                        rightctrls.btnFullscreenOn.visible = true;
                        rightctrls.btnFullscreenOff.visible = false;
    
    
                        // reset video display
                        vidDisplay.y = 0;
                        vidDisplay.x = 0;
                        vidDisplay.width = 480;
                        vidDisplay.height = 360;
      
                        var stagewidthmin:int = int(stage.stageWidth);
                        mcVideoControls.width = stagewidthmin;
                        videoscrubr.width = stagewidthmin;
                        videoscrubr.x = stagewidthmin / 2;
              }
    }
    

    Provided that the stage is set to noScale, you need to redraw everything when the mode full screen, using the relative measure against stageWidth/height.

    --

    Kenneth Kawamoto

    http://www.materiaprima.co.UK/

Maybe you are looking for