One question that Ansi join convert to (+)

Hi,
Original sql as below:
left join limit_order on limit_order.id = active_request_leg_map.DEAL_ID and limit_order.rita_deal_id = request.rita_deal_id
I want to use (+) instead of Ansi join, how to do it?
Thanks
Edited by: user886998 on 2011-4-4 下午9:01
Edited by: user886998 on 2011-4-4 下午9:02
Edited by: user886998 on 2011-4-4 下午9:05
Edited by: user886998 on 2011-4-4 下午9:06

Hi,
Welcome to the forum!
user886998 wrote:
Original sql as below:
left join limit_order on limit_order.id = active_request_leg_map.DEAL_ID and limit_order.rita_deal_id = request.rita_deal_id
I want to use (+) instead of Ansi join, how to do it?Why? Are you using Oracle 8 (or earlier)? That's the only good reason for using non-ANSI joins, especially for outer joins.
Whenever you post a question, say which version of Oracle you're using.
If you really must do this without ANSI joins, then join active_request_leg_map and request in a sub-query, and then join limit_order to that result set.
SELECT  ...
FROM    (
            SELECT  a.deal_id
            ,       r.rita_deal_id
            FROM    active_request_leg_map  a
            ,       request                 r
            WHERE   ...
        )            sq
,       limit_order  lo
WHERE   lo.id (+)            = sq.deal_id
AND     lo.rita_deal_id (+)  = sq.rita_deal_id
...If you'd care to post a little sample data (CREATE TABLE and INSERT statements for all tables) and the results you want from that data, then I could show you exactly, and test it.

Similar Messages

  • I just buy a Macbook pro, I have one question that when I use it at home, it is better to plug in AC power cord, or just use teh inernal battery withour AC power?

    I just buy a Macbook pro as a new MAC user. I conceren about internal battery life much. So I have one question that for battery life concern, it is better to use Macbook without AC poower in? or using AC power is better?
    Thanks, welcome anyone who can give me good sugegstion.
    Stephen
    22 Sep. from Taipei
    < Edited By Host >

    Either way is fine.
    About Batteries in Modern Apple Laptops
    Apple - Batteries - Notebooks
    Extending the Life of Your Laptop Battery
    Apple - Batteries
    Determining Battery Cycle Count
    Calibrating your computer's battery for best performance
    MacBook and MacBook Pro- Mac reduces processor speed when battery is removed while operating from an A-C adaptor
    Battery University

  • I want to buy iPhone 5 but i have one question that is i have just seen a video on youtube showing laser keyboard and holographic display. is it possible in iPhone 5 and if possible then whether this function is available in iPhone 5 or not...!

    Laser keyboard and holographic display

    There were some folks marketing a laser "keyboard" for computers a while ago. It is not beyond the realm of possibiity that somebody made one with a Bluetooth interface that could talk to an iPhone. It might well be beyond the average person's means to pay for it, though.

  • How do I change my security questions email? There is an old one attached that no longer works.

    How do I change my security questions email? There is an old one attached that no longer works.

    The Three Best Alternatives for Security Questions and Rescue Mail
        1. Use Apple's Express Lane.
              Go to https://expresslane.apple.com ; click 'See all products and services' at the
              bottom of the page. In the next page click 'More Products and Services, then
              'Apple ID'. In the next page select 'Other Apple ID Topics' then 'Forgotten Apple
              ID security questions' and click 'Continue'. Please be patient waiting for the return
              phone call. It will come in time depending on how heavily the servers are being hit.
         2.  Call Apple Support in your country: Customer Service: Contacting Apple for support or
              Apple ID- Contacting Apple for help with Apple ID account security. Ask to speak to
              Account Security.
         3.  Rescue email address and how to reset Apple ID security questions.
    How to Manage your Apple ID: Manage My Apple ID

  • Ho do I convert my Elements 5 Catalog to Elements 13 which I just purchased.  I followed one of the tutorials and converted my Elements 5 Catalog to a "pse.13db" file.  How do I get Elements 13 to recognize that converted file?  When I open Elements 13 Ca

    Ho do I convert my Elements 5 Catalog to Elements 13 which I just purchased.  I followed one of the tutorials and converted my Elements 5 Catalog to a "pse.13db" file.  How do I get Elements 13 to recognize that converted file?  When I open Elements 13 Catalog Manager and browse to the correct location, it doesn't show the file.  Help!  Thanks

    Bumps a écrit:
    Yes - I can run both versions on my PC.  But I really would like to have all of my pictures in the same catalog.
    You can't merge catalogs (even PSE13 ones) in any PSE version (only LR can do that). So, converting catalogs is not the solution to your problem.
    Since you have PSE5 working on your computer and your images also, the solution is to 'write metadata to files in PSE5) and to re-import the images in the PSE13 catalog. That won't duplicate your image files and you'll lose albums/collections, stacks and version sets, but you'll recover tags, captions and ratings.
    To be able to re-import the files indexed in PSE5, you may have to move them to a new master folder.
    I am not sure what your problem with the conversion may be. It's quite possible that the resulting catalog.pse13db is ok and that the issue lies in the ability to open it in the PSE13 organizer.
    As stated by dj_page, double clicking on that file should open the organizer with the new catalog. You could test that by creating a dummy catalog in PSE13 and importing a small batch of photos. Locate the path of the catalog with the menu Help/system info. Copy the catalog.pse13db in another folder and the 'double click' way to open the organizer with that moved catalog database.
    For other users that may be interested in using PSE5 (issued in 2006) on newer OS, here is a useful link:
    Adobe - Photoshop Elements : For Windows : Adobe Photoshop Elements 5.0.2 update

  • I am so angry because one min. I can buy something and now I can't with out the security question that I do know I swear I know but won't let me buy anything when I did yesterday.

    I am so angry because one min. I can buy something and now I can't with out the security question that I do know I swear I know but won't let me buy anything when I did yesterday. On iTunes

    If it's not accepting your answers, then if you have a rescue email address (which is not the same thing as an alternate email address) on your account then steps 1 to 5 half-way down this page will give you a reset link on your account : http://support.apple.com/kb/HT5312
    If you don't have a rescue email address (you won't be able to add one until you can answer your questions) then you will need to contact Support in your country to get the questions reset : http://support.apple.com/kb/HT5699
    When they've been reset (and if you don't already have a rescue email address) you can then use the steps half-way down the HT5312 link above to add a rescue email address for potential future use

  • HT201413 How can I reset my security question's.  These are not the one's that I have chosen.

    Help me change the security questions.  The one's that they have ask me or not the one's that I have chosen.  I have called about this before and still NO HELP.

    If you have a rescue email address (which is not the same thing as an alternate email address) set up on your account then steps 1 to 5 on the page that you posted from should let you reset them : go to https://appleid.apple.com/ and click 'Manage your Apple ID' on the right-hand side of that page and log into your account, then click on 'Password and Security' on the left-hand side of that page and on the right-hand side you should see an option to send security question reset info to your rescue email address.
    If you don't have a rescue email address (you won't be able to add one until you can answer 2 of your questions) then you won't get the reset option - you will need to contact iTunes Support or Apple to get the questions reset.
    e.g. you can try contacting iTunes Support : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Account Management , and then 'Forgotten Apple ID security questions'
    or try ringing Apple in your country and ask to talk to the Accounts Security Team : http://support.apple.com/kb/HE57
    When they've been reset (and if you don't already have a rescue email address) you can then use the steps half-way down the page that you posted from to add a rescue email address for potential future use, or if it's available in your country you could change to 2-step verification : http://support.apple.com/kb/HT5570

  • I forgot one answer of question that you asked in apple id

    Hi,
    I unable remember the answer of your second questions that you asked me in my Apple ID,so,pls,help me.thanks

    Read this about how to change the security questions: http://support.apple.com/kb/HT5312
    If you can't use these procedures contact Apple. See http://support.apple.com/kb/HT5699
    You can also call your country number from http://support.apple.com/kb/HE57 and ask to speak with Account Security.
    You can also go to the ExpressLane at https://expresslane.apple.com and then iTunes > iTunes Store > Password and Security Questions and fill out the form.

  • Need clarification on ANSI Joins

    Hi All,
    I need some clarification on the ANSI Join which I build to avoid an error when I am trying to execute the same in regular join.
    With Regular join I am getting the error ORA-01417: a table may be outer joined to at most one other table.
    Regular Join Condition:
    select null
    FROM
    land_event_device_fraud T1, --Update Dealer
    land_event_device_upgrade T2, --New Subscriber First Set
    syn_intg_event_device_state T3, --Existing Subscriber
    land_event_device_upgrade T4 --New Subscriber Second Set       
    WHERE T1.event_id = T2.event_id(+) AND T1.rate_plan_id = T2.rate_plan_id(+)
    AND T1.event_id = T3.event_id(+) AND T1.rate_plan_id = T3.rate_plan_id(+)
    AND T4.event_id = T1.event_id(+) AND T4.event_id = T1.rate_plan_id(+)
    AND T4.event_id = T3.event_id(+) AND T4.event_id = T3.rate_plan_id(+);
    --Getting error ORA-01417.
    Replaced the above join with ANSI Join
    SELECT NULL
    FROM land_event_device_fraud t1
    LEFT OUTER JOIN land_event_device_upgrade t2
    ON (t1.event_id = t2.event_id AND t1.rate_plan_id = t2.rate_plan_id)
    LEFT OUTER JOIN syn_intg_event_device_state t3
    ON (t1.event_id = t3.event_id AND t1.rate_plan_id = t3.rate_plan_id),
    land_event_device_upgrade t4
    LEFT OUTER JOIN land_event_device_fraud t5
    ON (t4.event_id = t5.event_id AND t4.rate_plan_id = t5.rate_plan_id)
    LEFT OUTER JOIN syn_intg_event_device_state t6
    ON (t4.event_id = t6.event_id AND t4.rate_plan_id = t6.rate_plan_id);
    I want to know whether the ANSI Join is goig to work fine or it is going to give me any cartesian production information.
    Appreciate your help here.
    Thanks,
    MK.

    Hi,
    Maddy wrote:
    Hi All,
    I need some clarification on the ANSI Join which I build to avoid an error when I am trying to execute the same in regular join.
    With Regular join I am getting the error ORA-01417: a table may be outer joined to at most one other table.
    Regular Join Condition:
    select null
    FROM
    land_event_device_fraud T1, --Update Dealer
    land_event_device_upgrade T2, --New Subscriber First Set
    syn_intg_event_device_state T3, --Existing Subscriber
    land_event_device_upgrade T4 --New Subscriber Second Set       
    WHERE T1.event_id = T2.event_id(+) AND T1.rate_plan_id = T2.rate_plan_id(+)
    AND T1.event_id = T3.event_id(+) AND T1.rate_plan_id = T3.rate_plan_id(+)
    AND T4.event_id = T1.event_id(+) AND T4.event_id = T1.rate_plan_id(+)
    AND T4.event_id = T3.event_id(+) AND T4.event_id = T3.rate_plan_id(+);
    --Getting error ORA-01417.
    Replaced the above join with ANSI Join
    SELECT NULL
    FROM land_event_device_fraud t1
    LEFT OUTER JOIN land_event_device_upgrade t2
    ON (t1.event_id = t2.event_id AND t1.rate_plan_id = t2.rate_plan_id)
    LEFT OUTER JOIN syn_intg_event_device_state t3
    ON (t1.event_id = t3.event_id AND t1.rate_plan_id = t3.rate_plan_id),
    land_event_device_upgrade t4
    LEFT OUTER JOIN land_event_device_fraud t5
    ON (t4.event_id = t5.event_id AND t4.rate_plan_id = t5.rate_plan_id)
    LEFT OUTER JOIN syn_intg_event_device_state t6
    ON (t4.event_id = t6.event_id AND t4.rate_plan_id = t6.rate_plan_id);You're mixing ANSI joins and old joins. That's very confusing. Use all of one kind or all of the other.
    >
    I want to know whether the ANSI Join is goig to work fine or it is going to give me any cartesian production information.What happens when you try it? Does it produce the results you want?
    Whenever you have a question, post a little sample data (CREATE TABLE and INSERT statements) and the results you want from that data. Explain how you get those results from that data.
    Always say which version of oracle you're using.
    See the forum FAQ {message:id=9360002}
    Why does the SELECT clause include only NULL? Is this going to be used as an EXISTS sub-query? If so, why bother to do outer joins, and why do you care if it does a Cartesian product? What is the compete query?
    For debugging purposes, you might want to include something that you can see in the SELECT clause.

  • Forms 10g and ANSI joins

    Hello,
    I had thought that Oracle Forms 10g was now fully in line with the 10g database in terms of the SQL and PL/SQL it supports. However, I notice that while I can use ANSI-syntax joins ('inner join', 'left outer join' etc) in record groups, I can't use them in trigger or procedure PL/SQL. For example, the following:
      cursor dist_bacs_csr(c_pln_id plan.id%TYPE)
      is
        select a.id as a_id
             , a.prcng_ccy_cd
             , a.sht_nam
             , a.dist_bac_key1
             , a.dist_bac_key2
        from   asset a
        inner join asset_hldg ash on (a.id = ash.a_id)
        inner join bank_acc bac on (a.dist_bac_key1 = bac.key1 and a.dist_bac_key2 = bac.key2)
        where ash.inc_acc_ind = 'I'
        and   ash.pln_id = c_pln_id
        order by ash.a_id;works fine in SQL Plus, but if I try to include it in my form, I get the error 'Encountered the symbol "INNER" when expecting one of the following: ,; for group having intersect minus order start union where connect'
    Does anyone know if Oracle plan to support ANSI joins in future versions of Forms? Or is there something obvious I'm missing..?
    Cheers,
    James
    Edited by: James Killeen on Aug 31, 2009 8:29 PM (The alias we normally use for the ASSET table apparently triggered the forum's filter against inappropriate language..! Replaced with a nice harmless 'a' instead...)

    Thanks for that - I tried FULL INNER JOIN as well but still wouldn't compile. I'll probably stick with the old-style join format for now, as I don't want to make this a procedure just so I can use the new syntax. A shame, though, as I much prefer the ANSI syntax - would be curious to know if Oracle have any plans to support it in future versions of Forms. Does anyone know if it's supported in Forms 11?

  • Flow accept error when using ANSI join syntax

    Hi
    I had a region populated by a query joining two views (one in-line using connect by). When trying to create the region if the join was coded using ANSI syntax (INNER JOIN .... USING) I got a flow accept error when either trying to proceed using the wizard, or apply changes when editing the region.
    After changing to the old style Oracle join (using predicates), I was able to create the region and everything worked ok. I found the solution after reading this post Error 404 wwv_flow.accept was not found in which the OP says he would raise a bug. Did the bug get raised? I ask since his problem arose whilst he was selecting from a view using ANSI joins and using instead of triggers, and I was joining an in-line view to a view using ANSI joins and instead of triggers, but neither view has been changed, just the join syntax. The view defined in the database is used in other regions and works fine. This could indicate the OP's problem was fixed, but one still exists.
    Incidentally this is the only time I have used non-ANSI joins in the entire apex app - the rest work!. Unfortunately it is impossible for me to demo the app.
    Richard
    using ApEx 3.0.1.00.07 and 10g (10.2.0.1) EE on Wintel

    Tyler,
    Apologies, what I was trying to say was that I couldn't put the application on the Oracle APEX site.
    Yes, I do have a work-around, but that does not mean a bug may still exist. I count myself fortunate I saw that post and, therefore, experimented with the syntax of the join - there is no reason APEX should not accept ANSI join conditions, in fact , it does. The ANSI-joined SQL statement executed perfectly in TOAD and SQL*Plus, but I could not even save it in APEX.
    regards
    Richard

  • Solution  to work in ANSI Join Condition

    Hi All,
    I am having one query which is using ANSI join syntax.
    The table TMP_GL_DATA having 237 records, when I am running the below query giving 237 records only if I remove the condition
    key word ' WHERE 1=1 ', ELSE ITS GIVING 0 records.
    How to give where condition if we use more than one table join with single table.
    If any one have ideal please let me know..
    See the below query for your reference.
         SELECT *
         FROM TMP_GL_DATA
         left outer join FCT_TP_RATES ON TMP_GL_DATA.v_repline1_code = FCT_TP_RATES.v_repline1_code
         left outer join FCT_NONCUST_PROD_TP_RATES ON TMP_GL_DATA.v_repline1_code = FCT_NONCUST_PROD_TP_RATES.v_repline1_code
         AND TMP_GL_DATA.v_prod_code = FCT_NONCUST_PROD_TP_RATES.v_prod_code
         AND TMP_GL_DATA.v_gl_ccy_code = FCT_NONCUST_PROD_TP_RATES.v_ccy_code
         inner join DIM_PRODUCT ON TMP_GL_DATA.v_prod_code = DIM_PRODUCT.v_prod_code
         left outer join VW_EFP_ADJ_RECORDS ON TMP_GL_DATA.v_gl_code = VW_EFP_ADJ_RECORDS.v_gl_code
         AND TMP_GL_DATA.v_lv_code = VW_EFP_ADJ_RECORDS.v_lv_code
         AND TMP_GL_DATA.v_gl_ccy_code = VW_EFP_ADJ_RECORDS.v_gl_ccy_code
         AND TMP_GL_DATA.v_branch_code = VW_EFP_ADJ_RECORDS.v_branch_code
         WHERE 1=1
         AND TMP_GL_DATA.V_GL_TYPE IN (Fn_I18n('L', 48),Fn_I18n('L', 51))
         AND TMP_GL_DATA.v_process_flag = 'A'
         AND TMP_GL_DATA.fic_mis_date = TO_DATE('20060601','YYYYMMDD')
         AND dim_product.f_latest_record_indicator = 'Y'
         AND fct_tp_rates.fic_mis_date = (SELECT MAX(fic_mis_date)
         FROM fct_tp_rates a
         WHERE a.v_repline1_code = a.v_repline1_code
         AND a.fic_mis_date <= TO_DATE('20060601','YYYYMMDD'))
         AND fct_noncust_prod_TP_RATES.FIC_MIS_DATE = (SELECT MAX(FIC_MIS_DATE)
         FROM fct_noncust_prod_tp_rates a
                                                                WHERE a.v_repline1_code = v_repline1_code
                                                                AND a.v_prod_code = v_prod_code
                                                                AND a.v_ccy_code = v_ccy_code
                                                                AND a.fic_mis_date <=TO_DATE('20060601','YYYYMMDD'))

    if you query is something like this that is giving you 0 records:
    SELECT *
      FROM TMP_GL_DATA
      left outer join FCT_TP_RATES ON TMP_GL_DATA.v_repline1_code = FCT_TP_RATES.v_repline1_code
      left outer join FCT_NONCUST_PROD_TP_RATES ON TMP_GL_DATA.v_repline1_code = FCT_NONCUST_PROD_TP_RATES.v_repline1_code
                 AND TMP_GL_DATA.v_prod_code = FCT_NONCUST_PROD_TP_RATES.v_prod_code
                 AND TMP_GL_DATA.v_gl_ccy_code = FCT_NONCUST_PROD_TP_RATES.v_ccy_code
      inner join DIM_PRODUCT ON TMP_GL_DATA.v_prod_code = DIM_PRODUCT.v_prod_code
      left outer join VW_EFP_ADJ_RECORDS ON TMP_GL_DATA.v_gl_code = VW_EFP_ADJ_RECORDS.v_gl_code
                 AND TMP_GL_DATA.v_lv_code = VW_EFP_ADJ_RECORDS.v_lv_code
                 AND TMP_GL_DATA.v_gl_ccy_code = VW_EFP_ADJ_RECORDS.v_gl_ccy_code
                 AND TMP_GL_DATA.v_branch_code = VW_EFP_ADJ_RECORDS.v_branch_code
       AND TMP_GL_DATA.V_GL_TYPE IN (Fn_I18n('L', 48),Fn_I18n('L', 51))
       AND TMP_GL_DATA.v_process_flag = 'A'
       AND TMP_GL_DATA.fic_mis_date = TO_DATE('20060601','YYYYMMDD')
       AND dim_product.f_latest_record_indicator = 'Y'
       AND fct_tp_rates.fic_mis_date = (SELECT MAX(fic_mis_date)
                                          FROM fct_tp_rates a
                                         WHERE a.v_repline1_code = a.v_repline1_code
                                           AND a.fic_mis_date <= TO_DATE('20060601','YYYYMMDD'))
                                           AND fct_noncust_prod_TP_RATES.FIC_MIS_DATE = (SELECT MAX(FIC_MIS_DATE)
                                                                                           FROM fct_noncust_prod_tp_rates a
                                                                                          WHERE a.v_repline1_code = v_repline1_code
                                                                                            AND a.v_prod_code = v_prod_code
                                                                                            AND a.v_ccy_code = v_ccy_code
                                                                                            AND a.fic_mis_date <=TO_DATE('20060601','YYYYMMDD'))you might want to try this:
    SELECT *
      FROM TMP_GL_DATA
      left outer join FCT_TP_RATES ON TMP_GL_DATA.v_repline1_code = FCT_TP_RATES.v_repline1_code
      left outer join FCT_NONCUST_PROD_TP_RATES ON TMP_GL_DATA.v_repline1_code = FCT_NONCUST_PROD_TP_RATES.v_repline1_code
                 AND TMP_GL_DATA.v_prod_code = FCT_NONCUST_PROD_TP_RATES.v_prod_code
                 AND TMP_GL_DATA.v_gl_ccy_code = FCT_NONCUST_PROD_TP_RATES.v_ccy_code
      inner join DIM_PRODUCT ON TMP_GL_DATA.v_prod_code = DIM_PRODUCT.v_prod_code
      left outer join VW_EFP_ADJ_RECORDS ON TMP_GL_DATA.v_gl_code = VW_EFP_ADJ_RECORDS.v_gl_code
                 AND TMP_GL_DATA.v_lv_code = VW_EFP_ADJ_RECORDS.v_lv_code
                 AND TMP_GL_DATA.v_gl_ccy_code = VW_EFP_ADJ_RECORDS.v_gl_ccy_code
                 AND TMP_GL_DATA.v_branch_code = VW_EFP_ADJ_RECORDS.v_branch_code
    WHERE TMP_GL_DATA.V_GL_TYPE IN (Fn_I18n('L', 48),Fn_I18n('L', 51))
       AND TMP_GL_DATA.v_process_flag = 'A'
       AND TMP_GL_DATA.fic_mis_date = TO_DATE('20060601','YYYYMMDD')
       AND dim_product.f_latest_record_indicator = 'Y'
       AND fct_tp_rates.fic_mis_date = (SELECT MAX(fic_mis_date)
                                          FROM fct_tp_rates a
                                         WHERE a.v_repline1_code = a.v_repline1_code
                                           AND a.fic_mis_date <= TO_DATE('20060601','YYYYMMDD'))
                                           AND fct_noncust_prod_TP_RATES.FIC_MIS_DATE = (SELECT MAX(FIC_MIS_DATE)
                                                                                           FROM fct_noncust_prod_tp_rates a
                                                                                          WHERE a.v_repline1_code = v_repline1_code
                                                                                            AND a.v_prod_code = v_prod_code
                                                                                            AND a.v_ccy_code = v_ccy_code
                                                                                            AND a.fic_mis_date <=TO_DATE('20060601','YYYYMMDD'))

  • Difference between oracle join syntaxes and ANSI join syntaxes

    What is difference between oracle join syntaxes and ANSI join syntaxes ?
    why oracle is having different syntaxes for joins than ANSI syntaxes ?
    Also Join syntaxes are different in some oracle vesrions ?

    BluShadow wrote:
    3360 wrote:
    Yes it is. The Oracle database wasn't initially designed to be ANSI compliant. As you correctly state the ANSI standards weren't around when it was initially designed, so the statement is perfectly correct. ;)Ok, in one sense it may be correct but it is a completely misleading statement. Not sure why you think it's misleading.Because there was no ANSI standard, so making it sound like a design choice The Oracle database wasn't initially designed to be ANSI compliant. would suggest to most readers that there was a standard to be compliant to.
    Like saying Ford originally did not design their cars to incorporate safety features such as ABS, seat belts and air bags.
    The OP asked "why oracle is having different syntaxes for joins than ANSI syntaxes ?" and the answer is that Oracle wasn't initially designed with ANSI compliance, so it has it's old non-ANSI syntax,As shown above, the old syntax was ANSI compliant at the time and to call it non-ANSI is either incorrect or misleading dependent on your point of view.
    and since ANSI syntax became the standard it now supports that. And since ANSI switched to a new standard, Oracle had to implement the new standard as well as the previous ANSI standard would be more accurate in my opinion.
    Nothing misleading as far as I'm aware in that.I find the whole discussion about ANSI and Oracle's supposed non-compliance, reads like it was Oracle's choice to deviate from the standards, when it was ANSI's bullheaded decisions to pointlessly change standards that left Oracle and other vendors out of compliance, and that was a decision made solely by ANSI.
    This is probably the reason ANSI no longer produces SQL standards, the endless syntax fiddling would eventually have made forward left under outer joins a reality.
    {message:id=1785128}

  • Tuning question. Self join vs Analytical function

    Hi all,
    I am a bit confused about this query cost.
    So I have this query. Now follow the original one (after rewritten by me):
    SELECT /*+ parallel (d 8) parallel(h 8) parallel(c 8) */
         DISTINCT
    d.customer_node_id AS root_customer_node_id,
    d.customer_node_id AS customer_node_id,
    nvl(h.account_id,c.account_id) AS account_id,
    nvl(h.account_name,c.account_name) AS account_name,
    d.service_id AS service_id,
    nvl((SELECT /*+ parallel(x 8) */ max(x.service_name) FROM delta_service_history x
    WHERE x.service_id=d.service_id AND v_upperbound_upd_dt BETWEEN x.effective_start_date AND x.effective_end_date GROUP BY x.service_id),d.service_name) AS service_name
    FROM
    delta_service_history d,
    delta_account c,
    stg_hierarchy h
    WHERE
    d.customer_node_id=c.customer_node_id(+) AND
    d.customer_node_id=h.customer_node_id(+)
    ......the new one (I decided to use analitycal function to calculate max(service_name) for each service_id instead of self join done for "delta_service_history" )
    I thought that self join was very heavy....
    Anyway, my two questions are:
    1. why the second one is heavier than the first. I reduce the number of join.....
    2. how can be rewritten the first one query? In particular way I don't like that self join..... :)
    Select Distinct
                   root_customer_node_id,
                   customer_node_id,
                   account_id,
                   account_name,
                   service_id,
    service_name
                   From
                                  SELECT /*+ parallel (d 8) parallel(h 8) parallel(c 8) */
                                  d.customer_node_id AS root_customer_node_id,
                                  d.customer_node_id AS customer_node_id,
                                  nvl(h.account_id,c.account_id) AS account_id,
                                  nvl(h.account_name,c.account_name) AS account_name,
                                  d.service_id AS service_id,
                                  d.service_name,
                                  row_number() over (partition by d.service_id order by d.service_name desc) r1
                             FROM
                                  delta_service_history d,
                                  delta_account c,
                                  stg_hierarchy_new h
                             WHERE
                                  d.customer_node_id=c.customer_node_id(+) AND
                                  d.customer_node_id=h.customer_node_id(+) AND
                                  v_upperbound_upd_dt BETWEEN d.effective_start_date AND d.effective_end_date
                             )a
                        Where a.r1 = 1
    Thank you all.

    I Post query plan.
    First one query (the original):
    Plan
    MERGE STATEMENT ALL_ROWSCost: 2.691.669 Bytes: 784.141.119.324 Cardinality: 1.754.230.692                                                                            
         27 MERGE STGADMIN.STG_HIERARCHY                                                                       
              26 PX COORDINATOR                                                                  
                   25 PX SEND QC (RANDOM) PARALLEL_TO_SERIAL SYS.:TQ10005 :Q1005Cost: 2.691.669 Bytes: 475.396.517.532 Cardinality: 1.754.230.692                                                             
                        24 VIEW PARALLEL_COMBINED_WITH_PARENT STGADMIN. :Q1005                                                       
                             23 HASH JOIN RIGHT OUTER BUFFERED PARALLEL_COMBINED_WITH_PARENT :Q1005Cost: 2.691.669 Bytes: 475.396.517.532 Cardinality: 1.754.230.692                                                   
                                  4 BUFFER SORT PARALLEL_COMBINED_WITH_CHILD :Q1005                                             
                                       3 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1005Cost: 20,828 Bytes: 860.278.720 Cardinality: 15.362.120                                         
                                            2 PX SEND HASH PARALLEL_FROM_SERIAL SYS.:TQ10000 Cost: 20,828 Bytes: 860.278.720 Cardinality: 15.362.120                                    
                                                 1 TABLE ACCESS FULL TABLE STGADMIN.STG_HIERARCHY Cost: 20,828 Bytes: 860.278.720 Cardinality: 15.362.120                               
                                  22 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1005Cost: 2.669.426 Bytes: 376.698.378.630 Cardinality: 1.752.085.482                                              
                                       21 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10004 :Q1004Cost: 2.669.426 Bytes: 376.698.378.630 Cardinality: 1.752.085.482                                         
                                            20 VIEW PARALLEL_COMBINED_WITH_PARENT STGADMIN. :Q1004Cost: 2.669.426 Bytes: 376.698.378.630 Cardinality: 1.752.085.482                                    
                                                 19 SORT UNIQUE PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 2.669.426 Bytes: 127.902.240.186 Cardinality: 1.752.085.482                               
                                                      18 HASH JOIN OUTER PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 35,386 Bytes: 127.902.240.186 Cardinality: 1.752.085.482                          
                                                           13 HASH JOIN OUTER PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 4,86 Bytes: 647.395.154 Cardinality: 13.212.146                     
                                                                8 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 1,961 Bytes: 158.611.600 Cardinality: 6.344.464                
                                                                     7 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10001 :Q1001Cost: 1,961 Bytes: 158.611.600 Cardinality: 6.344.464           
                                                                          6 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1001Cost: 1,961 Bytes: 158.611.600 Cardinality: 6.344.464      
                                                                               5 TABLE ACCESS FULL TABLE PARALLEL_COMBINED_WITH_PARENT STGADMIN.DELTA_SERVICE_HISTORY :Q1001Cost: 1,961 Bytes: 158.611.600 Cardinality: 6.344.464
                                                                12 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 2,879 Bytes: 368.690.880 Cardinality: 15.362.120                
                                                                     11 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10002 :Q1002Cost: 2,879 Bytes: 368.690.880 Cardinality: 15.362.120           
                                                                          10 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1002Cost: 2,879 Bytes: 368.690.880 Cardinality: 15.362.120      
                                                                               9 TABLE ACCESS FULL TABLE PARALLEL_COMBINED_WITH_PARENT STGADMIN.STG_HIERARCHY :Q1002Cost: 2,879 Bytes: 368.690.880 Cardinality: 15.362.120
                                                           17 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 28,982 Bytes: 5.838.854.928 Cardinality: 243.285.622                     
                                                                16 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10003 :Q1003Cost: 28,982 Bytes: 5.838.854.928 Cardinality: 243.285.622                
                                                                     15 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1003Cost: 28,982 Bytes: 5.838.854.928 Cardinality: 243.285.622           
                                                                          14 TABLE ACCESS FULL TABLE PARALLEL_COMBINED_WITH_PARENT STGADMIN.DELTA_ACCOUNT :Q1003Cost: 28,982 Bytes: 5.838.854.928 Cardinality: 243.285.622      
    ...second query
    Plan
    MERGE STATEMENT ALL_ROWSCost: 3.521.711 Bytes: 291.687.979.305 Cardinality: 652.545.815                                                                                                     
         32 MERGE STGADMIN.STG_HIERARCHY                                                                                                
              31 PX COORDINATOR                                                                                           
                   30 PX SEND QC (RANDOM) PARALLEL_TO_SERIAL SYS.:TQ10006 :Q1006Cost: 3.521.711 Bytes: 176.839.915.865 Cardinality: 652.545.815                                                                                      
                        29 VIEW PARALLEL_COMBINED_WITH_PARENT STGADMIN. :Q1006                                                                                
                             28 HASH JOIN RIGHT OUTER BUFFERED PARALLEL_COMBINED_WITH_PARENT :Q1006Cost: 3.521.711 Bytes: 176.839.915.865 Cardinality: 652.545.815                                                                            
                                  4 BUFFER SORT PARALLEL_COMBINED_WITH_CHILD :Q1006                                                                      
                                       3 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1006Cost: 20,828 Bytes: 860.278.720 Cardinality: 15.362.120                                                                  
                                            2 PX SEND HASH PARALLEL_FROM_SERIAL SYS.:TQ10000 Cost: 20,828 Bytes: 860.278.720 Cardinality: 15.362.120                                                             
                                                 1 TABLE ACCESS FULL TABLE STGADMIN.STG_HIERARCHY Cost: 20,828 Bytes: 860.278.720 Cardinality: 15.362.120                                                        
                                  27 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1006Cost: 3.500.345 Bytes: 140.125.783.665 Cardinality: 651.747.831                                                                       
                                       26 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10005 :Q1005Cost: 3.500.345 Bytes: 140.125.783.665 Cardinality: 651.747.831                                                                  
                                            25 VIEW PARALLEL_COMBINED_WITH_PARENT STGADMIN. :Q1005Cost: 3.500.345 Bytes: 140.125.783.665 Cardinality: 651.747.831                                                             
                                                 24 SORT UNIQUE PARALLEL_COMBINED_WITH_PARENT :Q1005Cost: 3.500.345 Bytes: 121.225.096.566 Cardinality: 651.747.831                                                        
                                                      23 VIEW PARALLEL_COMBINED_WITH_PARENT STGADMIN. :Q1005Cost: 1.195.554 Bytes: 121.225.096.566 Cardinality: 651.747.831                                                   
                                                           22 WINDOW SORT PUSHED RANK PARALLEL_COMBINED_WITH_PARENT :Q1005Cost: 1.195.554 Bytes: 58.005.556.959 Cardinality: 651.747.831                                              
                                                                21 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1005Cost: 1.195.554 Bytes: 58.005.556.959 Cardinality: 651.747.831                                         
                                                                     20 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10004 :Q1004Cost: 1.195.554 Bytes: 58.005.556.959 Cardinality: 651.747.831                                    
                                                                          19 WINDOW CHILD PUSHED RANK PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 1.195.554 Bytes: 58.005.556.959 Cardinality: 651.747.831                               
                                                                               18 HASH JOIN OUTER PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 34,402 Bytes: 58.005.556.959 Cardinality: 651.747.831                          
                                                                                    13 HASH JOIN OUTER PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 4,859 Bytes: 319.455.955 Cardinality: 4.914.707                     
                                                                                         8 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 1,963 Bytes: 152.576.580 Cardinality: 3.721.380                
                                                                                              7 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10001 :Q1001Cost: 1,963 Bytes: 152.576.580 Cardinality: 3.721.380           
                                                                                                   6 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1001Cost: 1,963 Bytes: 152.576.580 Cardinality: 3.721.380      
                                                                                                        5 TABLE ACCESS FULL TABLE PARALLEL_COMBINED_WITH_PARENT STGADMIN.DELTA_SERVICE_HISTORY :Q1001Cost: 1,963 Bytes: 152.576.580 Cardinality: 3.721.380
                                                                                         12 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 2,879 Bytes: 368.690.880 Cardinality: 15.362.120                
                                                                                              11 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10002 :Q1002Cost: 2,879 Bytes: 368.690.880 Cardinality: 15.362.120           
                                                                                                   10 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1002Cost: 2,879 Bytes: 368.690.880 Cardinality: 15.362.120      
                                                                                                        9 TABLE ACCESS FULL TABLE PARALLEL_COMBINED_WITH_PARENT STGADMIN.STG_HIERARCHY :Q1002Cost: 2,879 Bytes: 368.690.880 Cardinality: 15.362.120
                                                                                    17 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 28,982 Bytes: 5.838.854.928 Cardinality: 243.285.622                     
                                                                                         16 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10003 :Q1003Cost: 28,982 Bytes: 5.838.854.928 Cardinality: 243.285.622                
                                                                                              15 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1003Cost: 28,982 Bytes: 5.838.854.928 Cardinality: 243.285.622           
                                                                                                   14 TABLE ACCESS FULL TABLE PARALLEL_COMBINED_WITH_PARENT STGADMIN.DELTA_ACCOUNT :Q1003Cost: 28,982 Bytes: 5.838.854.928 Cardinality: 243.285.622

  • Help need for ansi join

    This is the sample piece of code in oracle which I am trying to convert it to ANSI join kindly help all the in_ and P_ and v_ are coming as a in parameter
    select *
    FROM    fxrates_v fx1
    WHERE fx1.fx_close(+) = in_fx_close AND
               fx1.fxrate_currency (+) =   decode (v_agree_type, 'L', upper(v_pledge_leh_unsec_curr) ,
                                                     'C', upper(v_pledge_cp_unsec_curr),
                                                     decode(sign(v_pre_mrgn_val), -1, upper(v_pledge_leh_unsec_curr),
                                                     upper(v_pledge_cp_unsec_curr)))/

    Michael I think your one is not equivalent to the OP's one.
    Let's see an example on EMP:
    SQL> select * from emp
      2  where comm(+) = 300;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
    SQL> select * from emp
      2  where comm(+) = null;
    no rows selected
    SQL> select * from emp right outer join dual on comm = 300;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO D
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30 X
    SQL> select * from emp right outer join dual on comm = null;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO D
                                                                                          XIf you add the right outer join on dual and the input parameter is null you extract an all nulls row.
    But the original query doesn't behave this way, the .(+) symbols have no effect on the result either if the input parameter is not null and if it is null...
    This is why I simply ignored them in my re-arrangement...
    So I think you can't convert the original query in ANSI sql preserving the behaviour...
    Am I missing something?
    Max
    http://oracleitalia.wordpress.com

Maybe you are looking for