ANSI join syntax with code-insight

I've noticed that SQL Developer 1.1.3 doesn't perform code-insight into table aliases when I use the ANSI join sytax. Is there a configuration option to make this possible or does it just not exist yet?

Hi,
Currently on SQL Developer 1.2, Windows XP, and Database 9.2
I have the same problem too.
The Code-Insight is unable to show the Code Completion for aliased table name in ANSI JOIN
SELECT *
FROM    Schema1.Table1 t1
INNER JOIN Schema1.Table2 t2 ON t2.     -- cannot show the code-insightHowever the following code works just fine for the code-insight
SELECT *
FROM    Schema1.Table1 t1,
              Schema1.Table2 t2
WHERE t1.Field1 = t2.Field1Any suggestion?
Regards,
Buntoro

Similar Messages

  • Use ansi join syntax

    From what i have been reading is better to use the new syntax(dont know how new it is)

    The ANSI join syntax was new to Oracle in Oracle 8i in 1998 - that's 15 years old.
    It can produce more readable code, and is both more readable and less human-error prone for outer joins.
    The ANSI format lets you outer join between multiple tables in a way the old oracle-specific ( + ) syntax did not and introduces FULL OUTER JOIN which you should use very rarely.
    You should not use NATURAL JOIN in code - adding unrelated columns to the tables involved can make it give very different results.
    There have not been significant bugs for ANSI joins in Oracle since Oracle 10.2 was introduced about 8 years ago.
    As Paul said, the ON part should be the join criteria between the tables. The were clause should be the filtering of the joined tables.
    So assuming start_date, end_date and in_property_id are variables
    SELECT resv_num, unit_date
        FROM p_resv_unit ru
        INNER JOIN p_pm_unit_night pun
        ON pun.resv_unit_id = ru.resv_unit_id
        WHERE pun.property_id = in_property_id
        AND pun.unit_date BETWEEN start_date AND end_date
        AND pun.pm_unit_num = cvUnitNum;
    If start_date and end_date were columns in p_resv_unit the query would be:
    SELECT resv_num, unit_date
        FROM p_resv_unit ru
        INNER JOIN p_pm_unit_night pun
        ON pun.resv_unit_id = ru.resv_unit_id AND pun.unit_date BETWEEN ru.start_date AND ru.end_date
        WHERE pun.property_id = in_property_id
            AND pun.pm_unit_num = cvUnitNum;
    Inner join queries work with criteria in the wrong place, but they're harder to read. Outer joins don't work unless you put the criteria in the right place.

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

  • 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

  • Case of schema names with code insight

    I'm running SQL Developer 3.0.04. I want my SQL statements to be of the form "SELECT * FROM schema.table" but I can't seem to find the right code insight option to make this happen. There seems to be a way to make everything lowercase (including keywords) but the closest I can get to what I really want is "SELECT * FROM SCHEMA.table".
    How do I stop the schema name being upper-cased when using code insight without affecting the keywords?

    I don't think you're understanding the issue. This is about code insight, not about the tables being defined in lower case. Here's a step by step example:
    SELECT * FROM mys<ctrl+space> -> SELECT * FROM myschema
    SELECT * FROM myschema.f<ctrl+space> -> SELECT * FROM MYSCHEMA.fred
    when what I want is "SELECT * FROM *myschema*.fred"

  • ANSI/9i Join Syntax and Pretty Code

    I've always tried to keep my SQL statement code formatted in a way that I think helps readability. I picked up the following style because I found it easy to quickly find the FROM clause and the JOINS or conditions:
    select e.ename,
           e.sal,
           d.dname
    from   emp e,
           dept d
       * Joins
    where  e.deptno = d.deptno
       * Conditions
    and    d.dname = 'SALES'
    /Of course, for such a simple query I wouldn't have used the comments to divide the WHERE clause into joins and conditions...
    Anyway, since Tom Kyte and the 9i documentation suggest using the ANSI join syntax (amongst other reasons), I have decided to begin changing my ways. However, I am having troubles figuring out how to format my SQL to still be "pretty."
    For the previous example, a new formatting style seems easy:
    select e.ename,
           e.sal,
           d.dname
    from   emp e
      join dept d          on e.deptno = d.deptno
    where  d.dname = 'SALES'
    /Now, when we use an example that has optional joins is where I can't figure what my style should be:
    select e.ename,
           m.ename as manager
    from        emp e
      left join emp m      on e.mgr = m.empno
    where  e.deptno = 10
    /I don't really like this style since it gets so wide, causing problems when indenting for subqueries/inline-views. It also looks kinda clunky because the tables are indented more than everything else...
    Anyway, since I don't want to spend a bunch of time figuring out things like style, I'd like to see what other formats people are using. I'd appreciate seeing how others are formatting thier SQL when using the new 9i (old-ANSI) syntax.
    Thanks, Stan

    That looks to me like left aligned (but I may be on the wrong side of the looking glass...)
    By preference is to left-align the KEYWORDS and the data words, using indentation to distinguish the start of the different clauses (SELECT, FROM, WHERE, ORDER BY, etc.). This approach is easily standardised with Textpad or similar editing tools. Quite how one programs a text editor to turn one's code into a Rorschach blot is beyond me.
    I haven't done much with ANSI joins, so I hadn't come up with a standard for layout. The following is what I think I would do if I ever had to, and is basically an adaption of what I do now ...
    FROM   user_indexes i
           , user_ind_columns ic2
           , user_tab_columns c2with the ANSI join stuff indented and aligned. I find rigourous application of UPPER and lower case tends to assist clarity: indentation and alignment are not enough.
    SELECT i.table_name
           , i.index_name
           , ic2.column_position
    FROM   user_indexes i
           INNER JOIN user_ind_columns ic2
           ON i.table_name = ic2.table_name
           AND i.index_name = ic2.index_name
           INNER JOIN user_tab_columns c2
           ON ic2.table_name = c2.table_name
           AND ic2.column_name = c2.column_name
    WHERE  i.uniqueness='UNIQUE'
    ORDER  BY i.table_name
           , i.index_name
           , ic2.column_position
    /

  • 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'))

  • Slow code insight in JDev 9.0.3.1035

    Hello,
    sometimes when I invoke code insight in my Jdev it needs up to 30 secs to display. In this time JDeveloper is completely blocked and does not react to any keyboard or mouse input. It doesn't matter if the library is on a network drive or on the local harddisk, even with standard JDK-Lib (for example: java.text. ) this problem appears. And, this happens not always, sometimes the popup comes as fast as I set in JDev's preferences.
    Has anyone experienced such a behaviour??
    Thank you.
    Christian

    Interesting... I confirmed via. Metalink that there was a bug within JDev 9.0.3.1 that caused code insight to fail when editing JSP against at least an Orace Portal based project.. I'm not sure if it's related, but I have a feeling it might be. Are you by chance developing with Portal? I've also noticed no problems with code insight when i'm working with straight webapps built from Struts. Perhaps it's to do with the libraries in your project.
    If you're on Windows, try the sysinternals file monitor program (www.sysinternals.com) and see if it's trying to access large files or something over the network.
    HTH,
    -sean

  • Code Insight not working properly - 9.0.3. preview

    We are having some problems with Code Insight on the 9.0.3 preview version of JDeveloper. We have a couple of libraries which regularly change so when a new version comes along we simply overwrite the old one (they are saved in <JDEV_HOME>\jlib. In 9.0.2 all we needed to do was exit and restart JDeveloper and the new classes could be seen in Code Insight. This doesn't seem to be the case now although my code compiles OK. We thought that there might be a cache of some sort related to these libraries and what we've found is a folder under <JDEV_HOME>\lib called ojpd. There appears to be a file for each library in here. We renamed
    the ones related to our libraries and this fixed our problems, but a new version was created. It seems to us that JDeveloper should be checking the modified date of any of these libraries and if so create a new 'ojpd' file. Is this a known bug?
    Thanks
    Ian

    JDeveloper actually checks the number of bytes in a .jar file that it has stored parse data for. I believe there was a bug in the preview release involving this check. This bug has since been fixed.
    To work around it in the preview you can delete the ojpd files corresponding to the archives you have changed. The files will be named after the archive, with a hash of the unique part of their path appended.
    These files are only built for archives that are included in libraries, and reside under Oracle Home (the directory containing the jdev directory), or the User Home.

  • Bug in JOIN syntax? (oracle 9i)

    Hi,
    take these three tables:
    MASTER (id NUMBER, name VARCHAR2(10))
    DETAIL (id NUMBER, master_id NUMBER)
    SUBDETAIL (id NUMBER, detail_id NUMBER, name VARCHAR(10)
    When I perform this query:
    SELECT SUBDETAIL.id as did, MASTER.id as mid
    FROM SUBDETAIL
    JOIN DETAIL ON (SUBDETAIL.detail_id = DETAIL.id)
    JOIN MASTER ON (DETAIL.master_id = MASTER.id)
    WHERE
    name = 'joe';
    I would expect the parser to give me 'column ambiguously defined' (because the 'name' field from the whereclause is defined in both subdetail and master).
    However, it does not say that. Instead, it assumes that it should use the name field from master. This is confusing, as this could easily lead to mistakes (as it did in my application)
    Greetings,
    Ivo

    There seems to be a difference between the way Oracle resolves column names using the ANSI join syntax and Oracle's syntax. It appears that Oracle does not know about the columns, until it processes each join, and further, the last table joined seems to be sued to resolve nameing conflicts. Consider:
    SQL> SELECT * FROM master;
            ID NAME
             1 joe
    SQL> SELECT * FROM subdetail;
            ID  DETAIL_ID NAME
             1          2 fred
    SQL> SELECT * FROM detail;
            ID  MASTER_ID
             2          1
    SQL> SELECT subdetail.id AS did, master.id AS mid
      2  FROM subdetail
      3       JOIN detail ON (subdetail.detail_id = detail.id)
      4       JOIN master ON (detail.master_id = master.id)
      5  WHERE name = 'joe';
           DID        MID
             1          1
    SQL> SELECT subdetail.id AS did, master.id AS mid
      2  FROM subdetail
      3       JOIN detail ON (subdetail.detail_id = detail.id)
      4       JOIN master ON (detail.master_id = master.id)
      5  WHERE name = 'fred';
    no rows selected
    So, it is clearly going after master.name. However,
    SQL> SELECT subdetail.id AS did, master.id AS mid
      2  FROM detail
      3       JOIN master ON (master.id = master_id)
      4       JOIN subdetail ON (subdetail.detail_id = detail.id)
      5  WHERE name = 'joe'
    no rows selected
    But,
    SQL> SELECT subdetail.id AS did, master.id AS mid
      2  FROM detail
      3       JOIN subdetail ON (subdetail.detail_id = detail.id)
      4       JOIN master ON (master.id = master_id)
      5  WHERE name = 'joe'
           DID        MID
             1          1
    Old style syntax gives:
    SQL> SELECT subdetail.id AS did, master.id AS mid
      2  FROM subdetail, detail, master
      3  WHERE subdetail.detail_id = detail.id and
      4        detail.master_id = master.id and
      5        name = 'joe';
          name = 'joe'
    ERROR at line 5:
    ORA-00918: column ambiguously defined
    and note that
    SQL> SELECT subdetail.id AS did, master.id AS mid
      2  FROM subdetail
      3      JOIN master ON (detail.master_id = master.id)
      4      JOIN detail ON (subdetail.detail_id = detail.id)
      5  WHERE name = 'joe'
        JOIN master ON (detail.master_id = master.id)
    ERROR at line 3:
    ORA-00904: invalid column nameSo, in ANSI syntax, order matters, and whatever the syntax good testing matters.
    TTFN
    John

  • Oracle 9i ansi joins

    Hi
    We are using oracle 9i database ,i want to use asni full outer join for below query .PLease any one how to use ?
    SELECT COLL_SUB_NMBR AS COLL_NO, CLCOLTP, SSUCYL AS CTRY_CD
    FROM TGDW_SGSSUTTRNP, TGDW_PAR_COLL
    WHERE TGDW_PAR_COLL.COLL_SUB_NMBR = TGDW_SGSSUTTRNP.COLLNO
    AND TGDW_PAR_COLL.COLL_TYPE = TGDW_SGSSUTTRNP.CLCOLTP
    AND TGDW_PAR_COLL.COLL_TYPE IN ( 1,21)
    UNION ALL
    SELECT COLL_SUB_NMBR AS COLL_NO, CLCOLTP, FDGCYBNK AS CTRY_CD
    FROM TGDW_SGFDGTRNP, TGDW_PAR_COLL
    WHERE TGDW_PAR_COLL.COLL_SUB_NMBR = TGDW_SGFDGTRNP.COLLNO
    AND TGDW_PAR_COLL.COLL_TYPE = TGDW_SGFDGTRNP.CLCOLTP
    AND TGDW_PAR_COLL.COLL_TYPE = 2
    Regards
    MM

    select COLL_SUB_NMBR, CLCOLTP, a.SSUCYL, b.FDGCYBNK from
    ( TGDW_SGSSUTTRNP join TGDW_PAR_COLL on
        (TGDW_PAR_COLL.COLL_SUB_NMBR = TGDW_SGSSUTTRNP.COLLNO TGDW_PAR_COLL.COLL_TYPE = TGDW_SGSSUTTRNP.CLCOLTP
    AND TGDW_PAR_COLL.COLL_TYPE IN ( 1,21)) a
    full outer join
    ( TGDW_SGFDGTRNP join TGDW_PAR_COLL on
        (TGDW_PAR_COLL.COLL_SUB_NMBR = TGDW_SGFDGTRNP.COLLNO AND TGDW_PAR_COLL.COLL_TYPE = TGDW_SGFDGTRNP.CLCOLTP AND TGDW_PAR_COLL.COLL_TYPE = 2)) b
    using (COLL_SUB_NMBR, CLCOLTP);This is not the same query, because the original query is not using outer join but it may help to figure out on how to use the ansi join syntax
    Regards
    Laurent Schneider
    OCM DBA

  • ANSI SQL Syntax - What belongs to join-clause and what to where-clause

    Hello,
    we currently have a discussion about the ANSI SQL Syntax where we do not agree what belongs to the join clause and what belongs to the where clause in an ANSI Sytnax SQL Query.
    Lets say there is a query like this:
    +SELECT *+
    FROM employees emp, departments dept
    WHERE emp.dept_country = dept.dept_country
    AND emp.dept_name = dept.dept_name
    AND dept.dept_type = 'HQ'
    AND emp.emp_lastname = 'Smith'
    Primary key of the departments table is on the columns dept_country, dept_name and dept_type. We have a Oracle database 10g.
    Now I have rewritten the query to Ansi Syntax:
    +SELECT *+
    FROM employees emp
    JOIN departments dept
    ON emp.dept_country = dept.dept_country AND emp.dept_name = dept.dept_name
    WHERE dept.dept_type = 'HQ'
    AND emp.emp_lastname = 'Smith'
    Another developer says that this is not completely correct, every filter on a column that belongs to the primary-key of the joined table has to be in the join clause, like this:
    +SELECT *+
    FROM employees emp
    JOIN departments dept
    +ON emp.dept_country = dept.dept_country AND emp.dept_name = dept.dept_name AND dept.dept_type = 'HQ'
    WHERE emp.emp_lastname = 'Smith'
    Can somebody tell me which on is correct?
    Is there any definition for that? I couldn't find it in the Oracle Database definition.
    I just found out the names of the ANSI documents here: http://docs.oracle.com/cd/B19306_01/server.102/b14200/ap_standard_sql001.htm#i11939
    I had a look at the ANSI webstore but there you have to buy the PDF files. In my case thats exaggerated because both of the Queries work and i am just interessted if there is one correct way.
    Thank you in advance
    Marco

    Hi,
    As i guideline i would say, answer the question: should the result of the join be filtered or should only filtered rows be joined from a particular table?
    This is helpful in the case of outer joins also, for inner joins it doesnt matters as said already be former posters, where there may be hughe semantical differences depending of where the predicates are placed.
    From performance view, if we talk about oracle, take a look a the execution plans. You will see that there is (probably) no difference in case of inner joins. Even in case of outer joins the optimizer pushes the predicate as a filter towards the table if it semantically possible.
    Regards

  • Outer join OJ syntax with JDBC drivers

    Hello,
    I'm facing a problem with CrystalReports 2008 and jdbc connection.
    Crystal genrates OJ syntax (as below) which cannot be interpreted by the Database.
    SELECT "T1"."T1D", "T2"."T2D", "T3"."T3D"
    FROM   {oj ("PUBLIC"."PUBLIC"."T3" "T3" LEFT OUTER JOIN "PUBLIC"."PUBLIC"."T2" "T2" ON "T3"."T2K"="T2"."T2K") LEFT OUTER JOIN "PUBLIC"."PUBLIC"."T1" "T1" ON "T2"."T1K"="T1"."T1K"}
    Prensently my database is HSQLDB.
    After browsing several post about ODBC, I tried to change the registry, introducing a new key
    HKEY_CURRENT_USER\Software\Business Objects\Suite 12.0\Crystal Reports\DatabaseOptions\NoOuterJoinEscSeq=myodbc3,hsqldb
    It did not change anything.
    Now, I suppose Crystal queries the database driver for its capabilities.
    This is done by a DatabaseMetaData object which implements several methods.
    In case of hsqldb, here is what the driver answers:
         public boolean supportsMinimumSQLGrammar() throws SQLException {
              return false;
         public boolean supportsCoreSQLGrammar() throws SQLException {
              return true;
         public boolean supportsExtendedSQLGrammar() throws SQLException {
              return false;
         public boolean supportsANSI92EntryLevelSQL() throws SQLException {
              return false;
         public boolean supportsANSI92IntermediateSQL() throws SQLException {
              return false;
         public boolean supportsANSI92FullSQL() throws SQLException {
              return false;
         public boolean supportsIntegrityEnhancementFacility() throws SQLException {
              return true;
         public boolean supportsOuterJoins() throws SQLException {
              return true;
         public boolean supportsFullOuterJoins() throws SQLException {
              return false;
         public boolean supportsLimitedOuterJoins() throws SQLException {
              return true;
    How can I tell Crystal to stop using the OJ syntax ?
    Thank you and kind regards.
    Alain

    Hi Alaine,
    You are correct, CR does query the driver to get what it requires to use for outer join syntax. The registry key will not work for this driver. It's the driver meta layer telling CR to use the oj syntax and is dependent on the driver being configured.
    Not sure if you can but start by trying to alter these settings if you can:
    public boolean supportsOuterJoins() throws SQLException {
    return true;
    public boolean supportsFullOuterJoins() throws SQLException {
    return false;
    I would think both should be reversed, true to false and false to true.
    Before you do that though go to our download page and install Service Pack 2, it may by a CR issue and the patch may have fixed the problem.
    If it doesn't I suggest asking this on the HSQLDB forum to see how to alter those option. CR follows the JDBC Type 4 Standards. You may want to see if Sun has a HSQLDB JDBC driver also.
    Thank you
    Don

  • ANSI inner join syntax

    Hi,
    Is there a way to configure BI Server 11g to generate ANSI join sytax ("INNER JOIN" clause) for Oracle, as it does when using OUTER JOINs?
    Thank you.

    OBIEE will not generate ANSI syntax for Inner Joins and as you said it only generates for Outer joins. Hope this clears your doubt.

  • ANSI/ISO JOIN SYNTAX

    DEAR Friends,
    How can i write the ansi/iso syntax for below query
    select a.company,b.fpm_ac_code from facmast a,fparty b, fstatus c
    where a.company = b.company(+)
    and a.fac_ac_code = b.fpm_ac_code(+)
    and a.company = c.company(+)
    one method is
    select a.company ,b.fpm_ac_ccode from facmast a right outer join fparty b on a.company = b.company
    and a.fac_ac_code = b.fpm_ac_code
    ,facmast c right outer join fstatus d on c.company = d.company
    but this is equivalent
    select a.company,b.fpm_ac_code from facmast a,fparty b,facmast c, fstatus d
    where a.company = b.company(+)
    and a.fac_ac_code = b.fpm_ac_code(+)
    and c.company = d.company(+)
    pls help me
    Siddharth singh

    I would transpose this statement...
    select a.company, b.fpm_ac_code
    from facmast a, fparty b, fstatus c
    where a.company = b.company(+)
    and a.fac_ac_code = b.fpm_ac_code(+)
    and a.company = c.company(+)
    into this...
    SELECT a.company, b.fpm_ac_code
    FROM facmast a
    LEFT OUTER JOIN fparty b
    ON a.company = b.company
    AND a.fac_ac_code = b.fpm_ac_code
    LEFT OUTER JOIN fstatus c
    ON a.company = c.company
    I think this may be closer to what you want.
    Remember, the (+) goes on the side that is deficient in information; but the LEFT or RIGHT keyword points to the table on the side of the JOIN clause (not the ON condition) from which you want information.
    Best!

Maybe you are looking for

  • Windows 7 - 64 Bit Driver Needed For Sound Blaster Live! 5.1 Model SB0100

    I am having trouble finding a working driver for Windows 7 - 64 Bit for a Sound Blaster Li've! 5. Audo Card Model# SB000 I downloaded driver file SBL_PC64DRVBETA_LB_2_03_0005.exe which I think is a 64 Bit Sound Blaster Li've! update, but Windows 7 do

  • Exporting sequence to Flash - no audio?

    Taking a sequence extracted from a long project to export to flash for web... looks AND sounds great in timeline, no audio after transcode. I do have the export audio ticked in the settings. Any help would be great, Thanks, Kenny

  • Installed CS3 Design Standard.. Acrobat 8 is just not there...

    Hi, Before installation I knew that there were some caomaptability problems with Acrobat 8 and Leopard but I installed CS3 Design Standard last night and during the installation I something telling me that Acrobat was already installed and after the

  • What Desktop calandars work with firefox 5

    I would like to add a calendar to my desktop. I understand the firefox add-on does not work with firefox 5. Is that correct? What desktop calendar will work with Firefox 5

  • I think my prefrence files are messed up......

    I had to re-install leopard because my HD failed.....i used to have iweb 06 and 08 running on the OS.....what i did before was copy the iweb 06 from the applications folder(default) to my home folder......then took all the domain files from the libra