Datawindow graphical syntax outer join BUG

Ok, so this is a bug report.  I don't know where i'm supposed to post it for SAP (i do have support).
The outer join syntax is ansi.
Using the graphical SQL designer, outer joins are incorrectly written by powerbuilder.  This has been going on ever since ANSI style outer join sytax was added (PB 9?).
I think it has to do with the datawindow's use of both right and outer joins and its lack of use of inner joins.  The end result is that we have to rewrite a lot of stuff in sql since powerbuilder is generating bad sql.
The typical example is the use of 2 or more outer joins where the joins are being done using 2 or more columns.
PB will create both a LEFT and a RIGHT outer join by duplicating the table name.  The table (receive) is only selected ONCE in the sql graphical designer.
And this is the result:
Microsoft SQL Native Client
The objects "receive" and "receive" in the FROM clause have the same exposed names. Use correlation names to distinguish them.
Do you want to correct errors?
I would love to see the datawindow sql corrected and written in a more standard way.
1 change the OUTER JOIN syntax in the db profile setup to indicate the syntax.  not outer join, but syntax.  If you select ANSI have it write ALL joins using JOIN ( from ta join tb on ta.col = tb.col) intead of from tablea, tableb where tablea.col = tableb.col
2 - eliminate the use of right outer joins.
At that point i believe that the datawindow could more easily be fixed by SAP to not duplicate tables when in generates the syntax.

If you have an Oracle Support agreement you can log a Service Request with Oracle, but they may respond that it is not really a bug. The problem is that the "outer" keyword in your 3rd example is being treated as an alias for TABLE_A because it is not considered a reserved keyword.
with table_a as (
select 1 as id, 'abc' as value_a from dual union all
select 2 as id, 'def' as value_a from dual union all
select 3 as id, 'ghi' as value_a from dual
, table_b as (
select 2 as id, 'jkl' as value_b from dual union all
select 3 as id, 'mno' as value_b from dual union all
select 4 as id, 'pqr' as value_b from dual
select ID, outer.VALUE_A, VALUE_B from TABLE_A outer join TABLE_B using (ID);
ID                     VALUE_A VALUE_B
2                      def     jkl
3                      ghi     mnoIf you query the V$RESERVED_WORDS view it will tell you which keywords are reserved.
select * from V$RESERVED_WORDS where keyword in ('OUTER', 'SELECT','USING');
KEYWORD                        LENGTH                 RESERVED RES_TYPE RES_ATTR RES_SEMI DUPLICATE
USING                          5                      N        N        N        N        N
OUTER                          5                      N        N        N        N        N
SELECT                         6                      Y        N        N        N        NYou would get a similar result if you tried
select ID, VALUE_A, VALUE_B from TABLE_A using join TABLE_B using (ID);Regards,
Bob

Similar Messages

  • Outer Join Bug !!

    Has anybody noticed there is a huge bug in Oracle 9.2.0.1 ?
    SELECT STRS.Text, STRS.Language
    FROM CTY LEFT OUTER JOIN STRS
    ON (STRS.Language='de' AND CTY.LanguageId=STRS.Num)
    returns:
    1 , 'Deutsch' , 'de'
    2 , 'Deutsch' , 'de'
    BUT if the condition is replaced by
    ON ('de'=STRS.Language AND CTY.LanguageId=STRS.Num)
    it returns:
    1 , 'nìmecky' , 'cs'
    2 , 'nìmecky' , 'cs'
    That means the condition "'de'=STRS.Language" is effectively ignored !!

    I don't think that's a bug.
    STRS.Language='de' is a where-condition and not a join-condition.
    Try:
    SELECT STRS.Text, STRS.Language
    FROM CTY LEFT OUTER JOIN STRS
    ON ( AND CTY.LanguageId=STRS.Num)
    WHERE STRS.Language='de';

  • Full outer join Bug or my misunderstanding?

    CREATE GLOBAL TEMPORARY TABLE BP_ATTRIBUTE_CHARVAL_GTT
       (     "ATTRIBUTE_ID" NUMBER(10,0),
         "PARTNER_ID" NUMBER(10,0),
         "CHAR_VALUE" VARCHAR2(4000 BYTE),
         "LAST_UPDATE_DATE" DATE,
         "DISABLE_DATE" DATE
       ) ON COMMIT DEETE ROWS ;
    CREATE  TABLE BP_ATTRIBUTE_CHARVAL
       (     "ATTRIBUTE_ID" NUMBER(10,0),
         "PARTNER_ID" NUMBER(10,0),
         "CHAR_VALUE" VARCHAR2(4000 BYTE),
         "LAST_UPDATE_DATE" DATE,
         "DISABLE_DATE" DATE
    REM INSERTING into BP_ATTRIBUTE_CHARVAL
    Insert into BP_ATTRIBUTE_CHARVAL (ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (888854,710326,'1',to_date('29-NOV-06','DD-MON-RR'),to_date('01-JAN-06','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL (ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591330,710326,'01',to_date('09-FEB-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL (ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591321,710326,'N',to_date('09-FEB-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL (ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591331,710326,'00',to_date('09-FEB-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL (ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591329,710326,'01',to_date('09-FEB-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL (ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591332,710326,'01',to_date('09-FEB-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL (ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591324,710326,'2',to_date('09-FEB-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL (ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591333,710326,'01',to_date('09-FEB-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL (ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591323,710326,'X1',to_date('09-FEB-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL (ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591334,710326,'BS',to_date('09-FEB-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    REM INSERTING into BP_ATTRIBUTE_CHARVAL_GTT
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591330,707408,'01',to_date('29-MAR-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591321,707408,'N',to_date('23-JAN-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591331,707408,'00',to_date('23-JAN-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591329,707408,'01',to_date('23-JAN-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591332,707408,'00',to_date('29-MAR-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591324,707408,'2',to_date('29-MAR-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591333,707408,'01',to_date('23-JAN-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591323,707408,'X1',to_date('23-JAN-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (591334,707408,'BS',to_date('23-JAN-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (876570,707408,'01',to_date('29-MAR-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT (ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (876568,707408,'1234560003264801',to_date('29-MAR-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (876569,707408,'f3a1d996-720e-4e0a-989c-6d4f3e8e629a',to_date('29-MAR-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    Insert into BP_ATTRIBUTE_CHARVAL_GTT(ATTRIBUTE_ID,PARTNER_ID,CHAR_VALUE,LAST_UPDATE_DATE,DISABLE_DATE) values (874948,707408,'20060318000000',to_date('29-MAR-06','DD-MON-RR'),to_date('07-NOV-01','DD-MON-RR'));
    select 707408,    
           decode(g.attribute_id,NULL,c.attribute_id,g.attribute_id) attribute_id,
           case
           when c.last_update_date is null and g.last_update_date is not null
           then
              g.char_value
            when g.last_update_date is null and c.last_update_date is not null 
            then
              c.char_value
            when g.last_update_date >= c.last_update_date
            then
                 g.char_value
           else
                c.char_value
           end   char_value,        
           decode(g.last_update_date,c.last_update_date,g.last_update_date,c.last_update_date) last_update_date,
           decode(g.disable_date,c.disable_date,g.disable_date,c.disable_date) disable_date
    from bp_attribute_charval_gtt g
    full outer join
         bp_attribute_charval c
    on c.attribute_id = g.attribute_id    
    where c.partner_id=710326;Hi Guys
    When I run the above query I get a problem.
    I am expecting to see is a merge of all the attribute_id's and their values.
    The query does not appear to be merging the data as intended.
    My understanding of the full outer join is that its a combination of left and outer joins,
    so the above query is intended to return with the total number of unique attributes
    and their appropriate values
    a) I have a bug in the Sql
    b) This is an oracle bug
    c) My understanding is incorrect
    Please Help
    Message was edited by:
    Keith Jamieson (fixed insert statements for gtt )

    How do you expect a full outer join operation when you have given --
    where c.partner_id=710326;According to your supplied data - i don't think your query can perform that full outer join operation because of that filtration. Just remove that last condition and checked it. You will get your desired result - hopefully.
    "It's like you want to view the things by closing down your both eyes". Do you think it will pay?
    Regards.
    Satyaki De.

  • Left outer join Bug? Oracle 11 g.

    Hi , I am facing a strange problem in oracle 11 g .
    I have a select query like this
    Query 1 :
    Select A.name, B.name, C.name from A Left outer join B on A.id = B.id left outer join C on b.id = c.id and (Some complex condition) left outer join D on C.id = D.id;
    A, B, C, D are tables.
    (Assume that I have data which satisfies the above join conditions)
    However I am not getting C.name in the result. Getting NULL in C.name.
    Now if I add a where clause to the above query like the following Query 2 then I get C.name in the results
    Consider that there is a field called field1 in table C and the value of field1 is ‘xyz’ for all the rows of table C .
    Query 2 :
    Select A.name, B.name, C.name from A Left outer join B on A.id = B.id left outer join C on b.id = c.id and (Some complex condition) left outer join D on C.id = D.id where c.field1 = ‘xyz’;
    I find this strange , What role where clause is playing ? Why I get C.name only after adding where clause.
    I also tried following setting with Query 1 however this also did not help me.
    alter session set "_optimizer_join_elimination_enabled"=false;
    Is oracle does some optimization if no where clause is specified ? Is this a bug?
    Please help me out.
    Thanks,
    Sumit

    874384 wrote:
    ...Is this a bug? Maybe. Maybe not. Really difficult to say based on your description. However, if you suspect a bug, then raise a ticket to the support including much more information (e.g. version 11.x.x.x, define "some condition" and so on).
    Nicolas.

  • ANSI SQL 92 SYNTAX OUTER JOIN PERFORMANCE ISSUE

    Good Morning
    Could anyone explain why the excution time for these two (ment to be identical)
    queries run so differently.
    oracle syntax execution time 1.06 seconds
    select COUNT(*) from
    PL_EVENT_VIEW pev,
    PL_EVENT_STAFF_VIEW pesv
    WHERE pev.EVENT_ID=PESV.EVENT_ID(+)
    AND pev.WEEKS=PESV.WEEK_NUM(+)
    AND pev.event_id=2520
    ansi sql 92 syntax execution time 7.05 seconds
    select COUNT(*) from
    PL_EVENT_VIEW pev
    LEFT JOIN PL_EVENT_STAFF_VIEW pesv
    ON (pev.EVENT_ID=PESV.EVENT_ID
    AND pev.WEEKS=PESV.WEEK_NUM)
    WHERE pev.event_id=2520
    Thanks
    David Hills

    BTW Oracle outer join operator (+) and ANSI SQL OUTER JOIN syntax are NOT equivalent. Consider following:
    DROP TABLE T1;
    CREATE TABLE T1 (C1 NUMBER);
    DROP TABLE T2;
    CREATE TABLE T2 (C2 NUMBER);
    DROP TABLE T3;
    CREATE TABLE T3 (C3 NUMBER);
    -- Following SELECT works:
    SELECT COUNT(*)
         FROM T1, T2, T3
         WHERE C2 = C1
              AND C3(+) = C1
    COUNT(*)
    0
    -- But:
    SELECT COUNT(*)
         FROM T1, T2, T3
         WHERE C2 = C1
              AND C3(+) = C1
              AND C3(+) = C2
    AND C3(+) = C1
    ERROR at line 4:
    ORA-01417: a table may be outer joined to at most one other table
    -- However with ANSI syntax:
    SELECT COUNT(*)
         FROM T1
         JOIN T2 ON (C2 = C1)
         LEFT JOIN T3 ON (C3 = C1 AND C3 = C2)
    COUNT(*)
    0

  • Full outer join ---  bug? Urgent

    Hi,
    I have a simple mapping using 2 source tables and doing an full outer join. While executing the mapping it is throwing me out with an error --
    Starting Execution LOAD_SAP
    Starting Task LOAD_SAP
    ORA-01790: expression must have same datatype as corresponding expression
    ORA-02063: preceding line from ODSD@LOC_TGT_LOC_ODSD
    ORA-06512: at "DWH_USER.LOAD_SAP", line 12
    ORA-06512: at "DWH_USER.LOAD_SAP", line 481
    ORA-06512: at "DWH_USER.LOAD_SAP", line 795
    ORA-06512: at "DWH_USER.LOAD_SAP", line 1973
    ORA-06512: at line 1
    Completing Task LOAD_SAP
    Completing Execution LOAD_SAP
    The SQL generated at line 12 is -
    CURSOR "JOIN_c" IS
    SELECT
    /*+ DRIVING_SITE("CONNECTION_LOC_TGT_LOC_ODSD") */
    "CONNECTION_LOC_TGT_LOC_ODSD"."END_USER_CUST_ID" "END_USER_CUST_ID",
    "SERVICE_LOC_TGT_LOC_ODSD"."SERVICE_NAME" "SERVICE_NAME",
    "CONNECTION_LOC_TGT_LOC_ODSD"."CE_CLLI" "CE_CLLI",
    "CONNECTION_LOC_TGT_LOC_ODSD"."PE_CLLI" "PE_CLLI"
    FROM "ODS"."CONNECTION"@"ODSD"@"LOC_TGT_LOC_ODSD" "CONNECTION_LOC_TGT_LOC_ODSD"
    FULL OUTER JOIN "ODS"."SERVICE"@"ODSD"@"LOC_TGT_LOC_ODSD" "SERVICE_LOC_TGT_LOC_ODSD" ON ("CONNECTION_LOC_TGT_LOC_ODSD"."END_USER_CUST_ID" = "SERVICE_LOC_TGT_LOC_ODSD"."END_USER_CUST_ID") ;
    If I replace the Full outer join with an equi join everything works fine. The SQL generated with an equi-join is ---
    SELECT
    /*+ DRIVING_SITE("CONNECTION_LOC_TGT_LOC_ODSD") */
    "CONNECTION_LOC_TGT_LOC_ODSD"."END_USER_CUST_ID" "END_USER_CUST_ID",
    "SERVICE_LOC_TGT_LOC_ODSD"."SERVICE_NAME" "SERVICE_NAME",
    "CONNECTION_LOC_TGT_LOC_ODSD"."CE_CLLI" "CE_CLLI",
    "CONNECTION_LOC_TGT_LOC_ODSD"."PE_CLLI" "PE_CLLI"
    FROM "ODS"."CONNECTION"@"ODSD"@"LOC_TGT_LOC_ODSD" "CONNECTION_LOC_TGT_LOC_ODSD",
    "ODS"."SERVICE"@"ODSD"@"LOC_TGT_LOC_ODSD" "SERVICE_LOC_TGT_LOC_ODSD" WHERE ( "CONNECTION_LOC_TGT_LOC_ODSD"."END_USER_CUST_ID" = "SERVICE_LOC_TGT_LOC_ODSD"."END_USER_CUST_ID" );
    We are using Oracle 9.2.0.4 AND OWB Clinet 9.2.0.2.8 and runtime repository 9.2.0.2.0.
    Any help on this appreciated?

    The discussion on this thread has moved to the later thread Problem with JOINs
    Nikolai

  • OBIEE not applying outer join syntax to filters

    (Note: I've already thoroughly searched the forums before posting this. Thanks)
    My problem is the following:
    I'm trying to build a report that is a count from my fact table, grouped by month from my date dimension for a given year, resulting in 12 data points. The problem is that not all months have actual data, but I still need those months to show on the report with a count of zero. Typical simple reporting requirement.
    I have already done the obvious and within my business layer made the join between my fact table and my date dimension an outer join on the fact side, just like you'd do if writing the query by hand. And when tested by hand this includes all dates for the year anyway, and when coupled with the appropriate null test on the count measure I'd get my 12 data points with zeros were appropriate.
    The problem is that there are additional filters I need to apply on the fact data (there are a couple text-based code values that didn't warrant full tables themselves so are just degenerate dimensions directly on the fact table.)
    When these filters are applied at the Answer level, I'm only getting back the months that actually have data, and lose the months where the count should be zero. A check of the session log for the query that was generated shows the problem. While OBI properly generates the outer-join syntax for the join itself between the two tables (my date dim and fact table) it does NOT apply the outer-syntax to the constant-based filter against the fact, effectively negating the outer join.
    Actual query from the log (I simply changed the table aliases from the ugly T##### stuff OBI generates to something more readable for posting here):
    select D.DT_MONTH_NAME as c1,
    D.DT_MONTH_NUM as c2,
    I.INC_TYPE as c3,
    I.INC_EMP_GROUP as c4,
    sum(case when I.INC_KEY is null then 0 else 1 end ) as c5
    from DATE_DIM D, INCIDENT_F I
    where ( D.DATE_KEY = I.DATE_KEY (+) ) and ( D.DT_YEAR = 2010 and I.INC_EMP_GROUP = 'CONTRACTOR' )
    group by D.DT_MONTH_NUM, D.DT_MONTH_NAME, I.INC_TYPE, I.INC_EMP_GROUP
    order by c2
    You can see that the outer syntax (+) is applied to the join, but not to the filter on I.INC_EMP_GROUP. If I take this query and drop it in something like SQL Developer, it only returns the months with data. If I throw the (+) after I.INC_EMP_GROUP like I'd do if writing this by hand, the desired zero-months results pop back in.
    I have already searched the forums and while lots of people seem to have asked this question, the only solutions involve things like trickery in the business layer using dummy fact tables followed by manipulations at the report level etc. Unfortunately I can't rely on these as the system is eventually to be turned over to users who can't be expected to apply various hacks to write reports.
    Anyone ever get to the bottom of getting OBI to apply outer join logic in filters as well, when the filtered table is meant to be outer-joined to?
    Any comments are appreciated.
    John

    I know that this thread is a bit old thought it might be helpful to some one...
    The Issue is, when using Degener@teDimen$ion ( this is !nner joned to FACT tables in BMM) and if any of the dimensions {other than theDegener@teDimen$ion (Let us say Dim X) } have an ()uter join to any of the fact tables, and you were doing your analysis using Degener@teDimen$ion,  Dim X, Measure value you will face the following issues.
    when filtering the analysis on the ()uter join dimension ( Dim X), the IN filter will not work. Reason is that the filter is getting applied to both the Dimension and FACT tables and the values that exist in Dimension Dim X but not in FACT table wont show up.
         The above issue can be fixed by changing the join between the fact and Degener@teDimen$ion from inner to outer. I think this is a bug.. because  it is supposed to filter the fact  table after the entire outer joined result is obtained but not filter the fact table for the Dim X values and do a outer join. I think the BI should be intelligent enough.

  • LEFT OUTER JOIN SQL syntax

    Haven't seen a solution to this on the forum or in the docs. My last post timed out with no responses, but I still don't know if I have a possible solution.
    I've got 2 objects, Task and Role, that are linked in a M-M relationship.
    My tables are:
    T_TASKS
    T_TASKSROLES
    T_ROLES
    I am querying T_TASKS and joining on T_TASKSROLES and T_ROLES, but I need to use an outer join because not all Tasks have a Role in T_TASKSROLES.
    In SQL Server, my FROM clause SHOULD look like this:
    FROM (T_TASKSROLES t2 LEFT OUTER JOIN T_TASKS t1 ON t1.ID = t2.TASKID) LEFT OUTER JOIN T_ROLES t0 ON t0.ID = t2.ROLEID
    however, if I use eb.anyOfAllowingNone(_roles) in my ExpressionBuilder. TopLink creates a LEFT OUTER JOIN clause that looks like this:
    FROM T_ROLES t0 LEFT OUTER JOIN T_TASKS t1 ON((t0.ID = T_TASKSROLES.ROLEID) AND (t1.ID = T_TASKSROLES.TASKID))
    I can see the logic in how it builds this clause. But, it doesn't parse in SQL Server.
    Is there a way to effect how TopLink generates the FROM clause for outer joins? I mean, I understand how to use the XXXPlatform.java source files and can change whether to use OuterJoin in the WHERE clause or not. But, I can't see anything in the platform class that would allow me to figure this out.
    I realize I could write SQL manually, but is there a way to do this so that the same code would work on SQL Server, Oracle, and Sybase (assuming the DatabaseLogin is configured appropriately)?
    It just seems like LEFT OUTER JOIN when joining M-M relationships isn't generating proper SQL. Is the TopLink SQL SQL92-compliant?
    I should add that I have tried to change SQLServerPlatform to have shouldPrintOuterJoinInWhereClause() return "true". This embeds a "=*" in the join conditions in the WHERE clause.
    SQL Server 2000 still supports this syntax, but the "=*" isn't ALWAYS the correct operator. It is important to put the "*" on the correct side of the expression. TopLink always prints "=*", but the operators are not always in the correct order. So, it tries to create a "left join" on the wrong table.
    So my other question, is it possible to force TopLink to remember to put the outer join table in the RIGHT SIDE?
    Nate

    The workaround is actually more complicated than that, and it can't be fixed by changing only the operator.
    In the queries you listed, the only difference is which side of the "AND" the expressions appear on.
    Change "(t2.rightid (+)= t1.rightid)" to "(t1.rightid (+)= t2.rightid)" and I'm guessing (although not sure because I am testing with SQL Server at the moment), that you'll get a similar query error as I did.
    The bug here is that the default M-M selection criteria creates "reltable = table1 AND table2 = reltable". There is no operator that can satisfy this expression.
    So, the fix that I made, for all of my M-M Mappings was to set the SelectionCriteria manually using the following Expression (returned from this method):
    // This puts M-M relationship tables on the same side of expressions so that OUTER JOINS can be supported.
    private Expression getSameSideExpression() {
              // target side
              Expression selectionCriteria = null;
    Enumeration e2 = getTargetKeyFields().elements();
    Enumeration e = getTargetRelationKeyFields().elements();
    ExpressionBuilder eb = new ExpressionBuilder();
    Expression relTableExp = null;
    while(e2.hasMoreElements()) {
    DatabaseField df = (DatabaseField) e.nextElement();
    DatabaseField df2 = (DatabaseField) e2.nextElement();
    if(relTableExp == null){
    relTableExp = eb.getTable(df.getTable());
    Expression targetFieldExp = eb.getField(df2);
    Expression relFieldExp = relTableExp.getField(df);
    Expression joinExp = relFieldExp.equal(targetFieldExp);
    if(selectionCriteria == null)
    selectionCriteria = joinExp;
    else
    selectionCriteria = joinExp.and(selectionCriteria);
              // source side
    e = getSourceRelationKeyFields().elements();
              e2 = getSourceKeyFields().elements();
    while(e.hasMoreElements()) {
    DatabaseField df = (DatabaseField) e.nextElement();
    DatabaseField df2 = (DatabaseField) e2.nextElement();
    Expression relFieldExp = relTableExp.getField(df);
    Expression sourceFieldExp = eb.getParameter(df2);
    Expression joinExp = relFieldExp.equal(sourceFieldExp);
    if(selectionCriteria == null)
                        selectionCriteria = joinExp;
    else
    selectionCriteria = joinExp.and(selectionCriteria);
              return selectionCriteria;
    This changes the M-M Selection Criteria to "table1 = reltable AND table2 = reltable". Now that this is consistent, using the WHERE clause for my joins in SQL Server is possible.
    If you can think of any other problems this change may have, please let me know.
    Thanks for the help.
    Nate

  • LEFT OUTER JOIN multiple tables - using the 9i syntax

    I've always written my queries using the (+) operator for outer joins. I want to start using the new ANSI standard available in 9i. I can do it when I'm joining two tables in a simple query, but how does it work when I am joining multiple tables?
    Here is an example of some SQL that works with the (+) outer join syntax. How can I convert this to use the LEFT OUTER JOIN syntax?
    SELECT *
    FROM audit_entry aue,
    audit_table aut,
    audit_statement aus,
    audit_row aur,
    audit_row_pkey aup1,
    audit_row_pkey aup2
    WHERE aue.audit_entry_id = aus.audit_entry_id
    AND aut.table_name = 'TEST_AUDITING'
    AND aut.table_owner = 'CLA_JOURNAL'
    AND aus.audit_table_id = aut.audit_table_id
    AND aur.audit_statement_id (+) = aus.audit_statement_id
    AND aup1.audit_row_id (+) = aur.audit_row_id
    AND aup1.pk_column_name (+) = 'TEST_AUDTING_PK_1'
    AND aup2.audit_row_id (+) = aur.audit_row_id
    AND aup2.pk_column_name (+) = 'TEST_AUDITING_PK_2'
    I can join audit_statement to audit_entry easy enough, but then I want to join audit_table to audit_statement, how do I do that, do I start nesting the join statements?
    Thanks
    Richard

    Thanks for getting back so quickly, I have tried the suggested SQL with mixed results:
    SELECT COUNT(*)
    FROM audit_entry aue
    JOIN audit_statement aus ON aue.audit_entry_id = aus.audit_entry_id
    JOIN audit_table aut ON aus.audit_table_id = aut.audit_table_id
    RIGHT OUTER JOIN audit_row aur ON aur.audit_statement_id = aus.audit_statement_id
    RIGHT OUTER JOIN audit_row_pkey aup1 ON aup1.audit_row_id = aur.audit_row_id
    RIGHT OUTER JOIN audit_row_pkey aup2 ON aup2.audit_row_id = aur.audit_row_id
    WHERE aut.table_name = 'TEST_AUDITING_TWO'
    AND aut.table_owner = 'CLA_JOURNAL'
    AND aup1.pk_column_name = 'TEST_AUDTING_PK_1'
    AND aup2.pk_column_name = 'TEST_AUDITING_PK_2'
    I had to change the order slightly, between the first two JOINs but otherwise it executed OK. My problem is, it should only return 175 rows but its returning 30625 rows. If I comment out the second reference to audit_row_pkey I get the expected result:
    SELECT COUNT(*)
    FROM audit_entry aue
    JOIN audit_statement aus ON aue.audit_entry_id = aus.audit_entry_id
    JOIN audit_table aut ON aus.audit_table_id = aut.audit_table_id
    RIGHT OUTER JOIN audit_row aur ON aur.audit_statement_id = aus.audit_statement_id
    RIGHT OUTER JOIN audit_row_pkey aup1 ON aup1.audit_row_id = aur.audit_row_id
    --RIGHT OUTER JOIN audit_row_pkey aup2 ON aup2.audit_row_id = aur.audit_row_id
    WHERE aut.table_name = 'TEST_AUDITING_TWO'
    AND aut.table_owner = 'CLA_JOURNAL'
    AND aup1.pk_column_name = 'TEST_AUDTING_PK_1'
    --AND aup2.pk_column_name = 'TEST_AUDITING_PK_2'
    It looks the same condition is being used in each case but why do I suddenly get so many rows - its joining differently somehow. It must be to do with the order, do I need to bracket the query?
    Thanks again
    Richard

  • While using the Old syntax of outer join i encountered Ora-01719 error .

    This is quite strange when i used the Old way of using Outer Joins(+), i encountered the Ora-01719 error saying Outer Joins not allowed in Or and IN operator.Whereas when i use the ANSI sql i query gets executed without any error.Any idea what might be the reason..is it that i myself is making mistake.
    Please find the select statement below..
    SELECT d4.c2, d4.c8, vw_rpt_prod_ln_grp.prod_grp_desc, d4.c10, d4.c5, d4.c3,
    CASE
    WHEN d4.c6 = 'Closed'
    THEN d4.c6
    WHEN d4.c6 = 'Closed (w/o Action)'
    THEN d4.c6
    WHEN d4.c6 =
    'Closed, Supporting Process(es) Active'
    THEN d4.c6
    WHEN d4.c6 = 'Cancelled'
    THEN d4.c6
    WHEN t3.workflow_compnt_id = 1
    THEN 'Definition'
    WHEN t3.workflow_compnt_id = 2
    THEN 'Root Cause'
    WHEN t3.workflow_compnt_id = 3
    THEN 'Solution'
    WHEN t3.workflow_compnt_id = 4
    THEN 'Implementation'
    WHEN t3.workflow_compnt_id = 5
    THEN 'Feedback'
    WHEN t3.workflow_compnt_id = 9
    THEN 'Preliminary Root Cause'
    WHEN t3.workflow_compnt_id = 2001
    THEN 'Report'
    WHEN t3.workflow_compnt_id = 2002
    THEN 'Sent'
    WHEN t3.workflow_compnt_id = 2003
    THEN 'Add. Info Needed'
    WHEN t3.workflow_compnt_id = 2004
    THEN 'Open'
    WHEN t3.workflow_compnt_id = 2007
    THEN 'Solution Feedback'
    END issue_workflow_status,
    CASE
    WHEN d4.c6 = 'Closed'
    THEN 0
    WHEN d4.c6 = 'Closed (w/o Action)'
    THEN 0
    WHEN d4.c6 =
    'Closed, Supporting Process(es) Active'
    THEN 0
    WHEN d4.c6 = 'Cancelled'
    THEN 0
    ELSE t3.workflow_compnt_id
    END issue_workflow_status_code,
    d4.c6, d4.c9,
    CASE t3.issue_step_status_cd
    WHEN 'In Progress'
    THEN t3.step_target_submit_dt
    WHEN 'Needs Additional Information'
    THEN t3.step_target_submit_dt
    WHEN 'Awaiting Approval'
    THEN t3.step_target_closed_dt
    ELSE NULL
    END target_date,
    CASE
    WHEN CASE t3.issue_step_status_cd
    WHEN 'In Progress'
    THEN t3.step_target_submit_dt
    WHEN 'Needs Additional Information'
    THEN t3.step_target_submit_dt
    WHEN 'Awaiting Approval'
    THEN t3.step_target_closed_dt
    ELSE NULL
    END IS NULL
    THEN 'N'
    WHEN CASE t3.issue_step_status_cd
    WHEN 'In Progress'
    THEN t3.step_target_submit_dt
    WHEN 'Needs Additional Information'
    THEN t3.step_target_submit_dt
    WHEN 'Awaiting Approval'
    THEN t3.step_target_closed_dt
    ELSE NULL
    END < TRUNC (CURRENT_DATE)
    THEN 'Y'
    ELSE 'N'
    END step_is_late,
    t3.orig_user_full_nm, t3.champ_user_full_nm, t3.champ_org_nm,
    vw_rpt_defntn.modl_yr_nbr, vw_rpt_vpps_lvl.level1_vpps_desc,
    vw_rpt_vpps_lvl.level2_vpps_desc, vw_rpt_vpps_lvl.level3_vpps_desc,
    vw_rpt_vpps_lvl.level4_vpps_desc,
    Mv_RPT_CONCAT_ENGN_OPTN_ALL.concat_engn_optn,
    vw_rpt_incdnt_src_three_level.level1_incdnt_src_desc,
    vw_rpt_incdnt_src_three_level.level2_incdnt_src_desc,
    vw_rpt_incdnt_src_three_level.level3_incdnt_src_desc,
    vw_rpt_warranty_labr_code.concat_warranty_labr_code_desc, d4.c4, d4.c7,
    vw_cust_survey_type.cust_survey_type_desc,
    vw_complaint_ctg.complaint_ctg_cd,
    vw_prob_main_cause.prob_main_cause_desc, soltn_step.confidence_lvl_id,
    d4.c12, d4.c13
    FROM (SELECT DISTINCT vw_rpt_issue.project_id c0,
    vw_rpt_issue.prts_prod_ln_id c1,
    vw_rpt_issue.issue_id c2,
    vw_rpt_issue.disply_issue_nbr c3,
    vw_rpt_issue.issue_sevrty_cd c4,
    vw_rpt_issue.proj_nbr c5,
    vw_rpt_issue.issue_status_cd c6,
    vw_rpt_issue.primry_metric_score_nbr c7,
    vw_rpt_issue.issue_type_cd c8, vw_rpt_issue.title c9,
    vw_rpt_issue.prts_prod_ln_desc c10,
    vw_rpt_leadtime.issue_id c11,
    vw_rpt_leadtime.definition_start_dt c12,
    vw_rpt_leadtime.definition_close_dt c13,
    vw_rpt_leadtime.root_cause_start_dt c14,
    vw_rpt_leadtime.root_cause_close_dt c15,
    vw_rpt_leadtime.solution_start_dt c16,
    vw_rpt_leadtime.solution_end_dt c17,
    vw_rpt_leadtime.implementation_start_dt c18,
    vw_rpt_leadtime.implementation_close_dt c19,
    vw_rpt_leadtime.feedback_start_dt c20,
    vw_rpt_leadtime.feedback_end_dt c21,
    vw_rpt_leadtime.prc_start_dt c22,
    vw_rpt_leadtime.prc_end_dt c23,
    defntn_step.issue_id c24,
    defntn_step.workflow_compnt_id c25,
    defntn_step.complaint_ctg_id c26,
    defntn_step.contnmt_actn_plan_id c27,
    defntn_step.direct_run_imprvm_pct c28,
    defntn_step.direct_run_loss_pct c29,
    defntn_step.drive_type_id c30,
    defntn_step.driving_cond_id c31,
    defntn_step.eng_pgm_nbr c32,
    defntn_step.engn_serial_nbr c33,
    defntn_step.envrnmtl_cond_id c34,
    defntn_step.ergo_rating_id c35,
    defntn_step.evaltn_complt_pct c36,
    defntn_step.evaltn_procdr_id c37,
    defntn_step.gca_50_or_safety_issue_flag c38,
    defntn_step.gca_value_amt c39,
    defntn_step.gm_rating_id c40,
    defntn_step.hardware_stage_id c41,
    defntn_step.incdnt_discvrd_by_nm c42,
    defntn_step.incdnt_discvr_dept_nm c43,
    defntn_step.incdnt_discvr_ph_nbr c44,
    defntn_step.incdnt_first_rptd_dt c45,
    defntn_step.incdnt_src_id c46,
    defntn_step.intrnl_measmt_info_owner_nm c47,
    defntn_step.intrnl_measmt_plt_faclty_id c48,
    defntn_step.intrnl_measmt_rpt_dt c49,
    defntn_step.issue_clasfn_id c50,
    defntn_step.issue_ctg_id c51,
    defntn_step.issue_intgrtn_id c52,
    defntn_step.modl_yr_id c53,
    defntn_step.modl_yr_qtr_id c54,
    defntn_step.odmtr_msmt_unit_id c55,
    defntn_step.odmtr_rdng_msmt_unit_id c56,
    defntn_step.odmtr_rdng_nbr c57,
    defntn_step.odmtr_rdng_beginning_nbr c58,
    defntn_step.odmtr_rdng_ending_nbr c59,
    defntn_step.part_drblty_msmt_unit_id c60,
    defntn_step.part_drblty_nbr c61,
    defntn_step.part_test_msmt_unit_id c62,
    defntn_step.part_test_nbr c63,
    defntn_step.pe_me_trial_issue_flag c64,
    defntn_step.pim_nbr c65,
    defntn_step.plt_asmbly_doc_nbr c66,
    defntn_step.productivity_nbr c67,
    defntn_step.suspect_parts_avbl_flag c68,
    defntn_step.suspect_parts_loc_txt c69,
    defntn_step.trnsmn_serial_nbr c70,
    defntn_step.veh_ident_nbr c71,
    defntn_step.veh_proprt_nbr c72,
    defntn_step.veh_test_msmt_unit_id c73,
    defntn_step.veh_test_nbr c74,
    defntn_step.vpps_id_nbr c75,
    defntn_step.wrkstn_id c76,
    defntn_step.road_surface_id c77,
    defntn_step.cost_redctn_rpt_dt c78,
    defntn_step.cost_redctn_trackg_nbr c79,
    defntn_step.cost_redctn_type_id c80,
    defntn_step.cust_survey_dt c81,
    defntn_step.warnty_impct_rpt_dt c82,
    defntn_step.field_prod_rpt_nbr c83
    FROM (SELECT DISTINCT mv_rpt_issue_all.project_id
    project_id,
    mv_rpt_issue_all.prts_prod_ln_id
    prts_prod_ln_id,
    mv_rpt_issue_all.issue_id issue_id,
    mv_rpt_issue_all.disply_issue_nbr
    disply_issue_nbr,
    mv_rpt_issue_all.issue_sevrty_cd
    issue_sevrty_cd,
    mv_rpt_issue_all.proj_nbr proj_nbr,
    mv_rpt_issue_all.issue_status_cd
    issue_status_cd,
    mv_rpt_issue_all.primry_metric_score_nbr
    primry_metric_score_nbr,
    mv_rpt_issue_all.issue_type_cd
    issue_type_cd,
    mv_rpt_issue_all.title title,
    mv_rpt_issue_all.prts_prod_ln_desc
    prts_prod_ln_desc
    FROM mv_rpt_issue_all,
    vw_sec_acs_grp_proj acs_grp_proj
    WHERE acs_grp_proj.acs_grp_id IN
    (1,
    4,
    42,
    43,
    44,
    51,
    52,
    53,
    54,
    266,
    366,
    386,
    526,
    546,
    547,
    548,
    566,
    846,
    946,
    966,
    1006,
    1066,
    1087
    AND mv_rpt_issue_all.prts_prod_ln_id =
    acs_grp_proj.prts_prod_ln_id
    AND mv_rpt_issue_all.project_id =
    acs_grp_proj.project_id
    AND mv_rpt_issue_all.issue_type_cd =
    'Current Production') vw_rpt_issue,
    vw_rpt_leadtime,
    vw_defntn_step defntn_step
    WHERE vw_rpt_issue.issue_id = vw_rpt_leadtime.issue_id
    AND vw_rpt_issue.issue_id = defntn_step.issue_id) d4,
    vw_rpt_incdnt_src_three_level,
    vw_rpt_warranty_labr_code,
    vw_rpt_prod_ln_grp,
    (SELECT t1.issue_id issue_id, t1.workflow_compnt_id workflow_compnt_id,
    t1.issue_step_status_cd issue_step_status_cd,
    t1.step_target_closed_dt step_target_closed_dt,
    t1.step_target_submit_dt step_target_submit_dt,
    t1.orig_user_full_nm orig_user_full_nm,
    t1.champ_user_full_nm champ_user_full_nm,
    t1.champ_org_nm champ_org_nm
    FROM prts_syst.vw_rpt_issue_step_dtl_all t1
    WHERE t1.current_step_flag = 'Y') t3,
    vw_complaint_ctg,
    root_cause_step,
    vw_prob_main_cause,
    Mv_RPT_CONCAT_ENGN_OPTN_ALL,
    vw_rpt_vpps_lvl,
    soltn_step,
    vw_rpt_defntn_all vw_rpt_defntn,
    vw_cust_survey_impct_dtl cust_survey_impct_dtl,
    vw_cust_survey_type
    WHERE d4.c46 = vw_rpt_incdnt_src_three_level.level3_incdnt_src_id(+)
    Or d4.c46=vw_rpt_incdnt_src_three_level.level2_incdnt_src_id(+))
    And vw_rpt_incdnt_src_three_level.level3_incdnt_src_id IS NULL
    AND d4.c2 = vw_rpt_warranty_labr_code.issue_id(+)
    AND d4.c1 = vw_rpt_prod_ln_grp.prts_prod_ln_id(+)
    AND d4.c2 = t3.issue_id(+)
    AND d4.c26 = vw_complaint_ctg.complaint_ctg_id(+)
    AND d4.c2 = root_cause_step.issue_id(+)
    AND root_cause_step.prob_main_cause_id = vw_prob_main_cause.prob_main_cause_id(+)
    AND d4.c2 = Mv_RPT_CONCAT_ENGN_OPTN_ALL.issue_id(+)
    AND d4.c75 = vw_rpt_vpps_lvl.vpps_id_nbr(+)
    AND d4.c2 = soltn_step.issue_id(+)
    AND d4.c2 = vw_rpt_defntn.issue_id(+)
    AND d4.c2 = cust_survey_impct_dtl.issue_id(+)
    AND cust_survey_impct_dtl.cust_survey_type_id = vw_cust_survey_type.cust_survey_type_id(+)
    AND vw_rpt_prod_ln_grp.prod_grp_desc IN
    ('DB Admin', 'GM - All Vehicles', 'GMAP - DAT', 'GMAP - Holden')
    AND d4.c6 IN
    ('Cancelled',
    'Closed',
    'Closed (w/o Action)',
    'Closed, Supporting Process(es) Active',
    'Draft',
    'Open'
    );

    Hi,
    Maestro_Vineet wrote:
    This is quite strange when i used the Old way of using Outer Joins(+), i encountered the Ora-01719 error saying Outer Joins not allowed in Or and IN operator.Whereas when i use the ANSI sql i query gets executed without any error.Any idea what might be the reason..is it that i myself is making mistake.No, I don't think you're making any mistake. Some things are simply not allowed with the "+" outer-join syntax.
    There are work-arounds, but they are harder to code and slower to run than simply using ANSI syntax.
    I recommend always using ANSI syntax, especially for outer joins.

  • Oracle 8i Full Outer Join Syntax

    Can someone please help me run this on Oracle 8i:
    SELECT
    R.CUSTOMER_NUM,
    R.SURNAME_NM,
    R.FIRST_NM,
    R.STREET_NM,
    R.PROV_CD,
    R.CITY_NM,
    R.POSTL_CD,
    W.ADDR_TWO_DESC,
    C.RTL_CO_NUM,
    C.CARD_NUM
    FROM
    RTL_CUST R
    FULL OUTER JOIN WHLSL_CUST W ON (R.CUST_NUM = W.CUST_NUM)
    FULL OUTER JOIN CUSTOMER_CARD C ON (T.CUST_NUM = C.CUST_NUM)
    I only know the ANSI syntax. Whats the old one?

    Is this correct:
    SELECT R.CUST_NUM, R.SURNAME_NM, R.FIRST_NM, R.STREET_NM, R.PROV_CD, R.CITY_NM, R.POSTL_CD, W.ADDR_TWO_DESC, NULL AS RTL_CO_NUM, NULL AS CARD_NUM
    FROM CCD_RTL_CUST R, CCD_WHLSL_CUST W WHERE R.CUST_NUM (+) = W.CUST_NUM
    UNION
    SELECT R.CUST_NUM, R.SURNAME_NM, R.FIRST_NM, R.STREET_NM, R.PROV_CD, R.CITY_NM, R.POSTL_CD, W.ADDR_TWO_DESC, NULL AS RTL_CO_NUM, NULL AS CARD_NUM
    FROM CCD_RTL_CUST R, CCD_WHLSL_CUST W WHERE R.CUST_NUM = W.CUST_NUM (+)
    UNION
    SELECT R.CUST_NUM, R.SURNAME_NM, R.FIRST_NM, R.STREET_NM, R.PROV_CD, R.CITY_NM, R.POSTL_CD, NULL AS ADDR_TWO_DESC, C.RTL_CO_NUM, C.CARD_NUM
    FROM CCD_RTL_CUST R, CUST_CARD C WHERE R.CUST_NUM (+) = C.CUST_NUM
    UNION
    SELECT R.CUST_NUM, R.SURNAME_NM, R.FIRST_NM, R.STREET_NM, R.PROV_CD, R.CITY_NM, R.POSTL_CD, NULL AS , C.RTL_CO_NUM, C.CARD_NUM
    FROM CCD_RTL_CUST R, CUST_CARD C WHERE R.CUST_NUM = C.CUST_NUM (+);

  • Outer join syntax - oracle 8i

    Here is an Oracle 8i issue I've run into ....
    I am trying to create a table that contains a record for each hour of the day (even if count is 0). I have a problem when I try a right outer join using the following syntax:
    SELECT MDT.date_field, COUNT(*)
    FROM MASTER_DATE_TABLE MDT, hsa_tgt.PICIS_OR POR
    WHERE MDT.date_field = TO_CHAR(POR.OR_IN_DTTM,'YYYYMMDDHH24') (+)
    AND TO_DATE(MDT.date_field,'YYYYMMDDHH24') >= '01-Jan-2006'
    AND TO_DATE(MDT.date_field,'YYYYMMDDHH24') <= '31-Jan-2006'
    GROUP BY MDT.date_field;
    The problem 'SQL code no properly ended' only occurs if I use the TO_CHAR function (or any function for that matter) on the outer join line.
    Is there a workaround? I did manage to create a temporary table and then successfully do an outer join in order to bypass having the to_char function in the join statement.
    Maybe a union?
    TIA

    I had to put it in a subquery? (if that's what it's called)
    SELECT a1.date_field DateAndHour, b1.OR_date, NVL(b1.record_count,0)
    FROM  MASTER_DATE_TABLE a1,
                  (SELECT TO_CHAR(b.OR_IN_DTTM,'YYYYMMDDHH24') OR_date, COUNT(*) record_count
                FROM hsa_tgt.PICIS_OR b
                GROUP BY TO_CHAR(b.OR_IN_DTTM,'YYYYMMDDHH24')) b1
    WHERE a1.date_field  = b1.OR_date (+)
    GROUP BY a1.date_field, b1.OR_date, b1.record_count
    HAVING (TO_DATE(a1.date_field,'YYYYMMDDHH24') BETWEEN '01-Jan-2006' AND '31-Jan-2006')
    ORDER BY a1.date_field;

  • Outer Join Syntax in sql2k to Oracle Migration

    All of my existing SQL Server 2000 code is using the (INNER, LEFT OUTER, RIGHT OUTER) JOIN syntax which according to Oracle SQL Reference (A90125-01) is supported. The migration workbench seems to want to convert this to the old style syntax of putting (+) in the where clause conditions. I am therefore getting lots of warnings telling me that "complex outer joins are not reliably supported". Is there a setting somewhere that will tell the migration workbench to maintain (subject to required conversion) the original syntax format.

    Hi Doug,
    The issue you report has been tackled in a recent internal build released by the OMWB team. OMWB version 9.2.0.1.6 which is freely downloadable on the http:\\mtg.ie.oracle.com site. As I've mentioned, this is an internal release and is therefore not supported - although it is very stable and has already been used by several internal customers. We expect to have a fully supported release of OMWB available on OTN in December.
    In version 9.2.0.1.6, there is an option in the "Parse Options" tab on the Stored Procedures property sheet called "Generate Oracle 8i Outer Joins" - this setting is switched off by default in this build and would therefore preserve your ANSI compliant joins by default. Switching the setting on causes the OMWB parser to generate the joins in the old (+) Oracle syntax standard.
    I hope this helps,
    Tom.

  • Issue with Outer Join (Possible Bug)

    Hi,
    I am using Toplink 10.3.3 with oracle as db. I noticed that if I use outer joins with collections, then toplink doesnt add (+) sign to the where clause of the collection.
    For e.g. for a relationship - Employee has projects, if I do an outer join on projects and also provide a where clause for projects collection, the query doesnt include the (+) sign in it.
    Expression expr = builder.anyOfAllowingNone("projects").getAllowingNull("anotherOne-OneMapping").get("attr").equal("Value")
    This expr goes in the where clause and TopLink does not generate (+) in the query alongside attr = "Value"
    I have tried this from workbench as well as Java. Could anyone please confirm that the above scenario works? May be this is a bug in toplink !
    TIA
    Ani

    I too have found a few bugs with full outer joins. Many of them have been fixed in 9iR2 though.
    Like this one simple one on unpatched 9iR1: select foo1.x, foo2.x
    from foo1 full outer join (select * from foo2 where x = :bindx) foo2 on (foo1.y = foo2.y)
    ERROR at line 2:
    ORA-00600: internal error code, arguments: [qctcte1], 0], [], [], [], [], [], []Fixed here: Hdr: 2458655 9.0.1.3.0 RDBMS 9.0.1.3.0 SQL LANGUAGE PRODID-5 PORTID-453
    Abstract: ORA-600 [QCTECTE1] ON QUERY WITH FULL OUTER JOIN AND BIND VARIABLES

  • Query builder bug in outer joins ?

    I understood that if you were joining two tables A and B, the following was a
    LEFT OUTER JOIN
    SELECT A.COL, B.COL
    FROM A, B
    WHERE A.ID = B.ID (+)
    ie: a LEFT outer join has the (+) on the Right-hand table.
    However, query builder puts the (+) on the Left-hand table.
    Same for a RIGHT outer join - I think the (+) should be on the Left-hand table, but query builder puts it on the Right-hand table.
    Cheers,
    Andrew
    (running Version 2.1.0.00.39)

    Hi Andrew,
    I just played a little with the query builder and created a join between two of my tables:
    PROJECTS and ACTIVITIES, linked via KCC.
    When I create a left outer join in query builder, I get the following result:
    select     "PROJECTS"."KCC" as "KCC"
    from     "ACTIVITIES" "ACTIVITIES",
         "PROJECTS" "PROJECTS"
    where "PROJECTS"."KCC"(+) ="ACTIVITIES"."KCC"
    Which is correct: Left refers to the first table in the from clause (ACTIVITIES) and places the (+) on the other table!
    Left and right refers to the order of tables in the from clause, not in the where clause. Query builder sorts the tables in FROM alphabetically, maybe this is differing from the graphical order in query builder.
    Regards
    Alex

Maybe you are looking for

  • Scenario for Process Manufacturing..

    Dear All, Our client imports goods and then packages them at their site into different packages and boxes. After that those products are dispatched. The client wants to keep an eye on the status of packaging and for that they require a Manufacturing

  • Using iPhone from Australia in Thailand

    I am looking to buy a iPhone 4s as a gift for a friend in Thailand will a phone purchased in Australia be suitable or should I purchase it from apple store Thailand

  • Assigning overheads to Cost collector using cost center assessments

    Dear All, I want to assign admin and selling overheads to product cost collectors for different products using cost center assessment. I am creating the cycle for assessment and in the receiver objects i am not able to get product cost collectors. In

  • ODBC 10.1.0.4 Requires 10.1.0.3 installer. Where is it?

    Trying to install ODBC 10.1.0.4. but the 10.1.0.2 client that comes with the most recent client download doesn't work. It needs 10.1.0.3 or greater. Can someone point me to a new installer download or patch? Thanks Bob

  • AE CS4  Color management with HDTV

    Working with the Sony EX1 and EX3 which according to Sony engineers works in the 709 HDTV colorspace. This space is about a dead ringer for sRGB when overlayed in Colorthink. The issue I am having is that if you actually assign the 709 or sRGB profil