Inconsistent results with ANSI LEFT JOIN on 9iR2

Is this a known issue? Is it solved in 10g?
With the following data setup, I get inconsistent results. It seems to be linked to the combination of using LEFT JOIN with the NULL comparison within the JOIN.
create table titles (title_id int, title varchar(50));
insert into titles values (1, 'Red Book');
insert into titles values (2, 'Yellow Book');
insert into titles values (3, 'Blue Book');
insert into titles values (4, 'Orange Book');
create table sales (stor_id int, title_id int, qty int, email varchar(60));
insert into sales values (1, 1, 1, '[email protected]'));
insert into sales values (1, 2, 1, '[email protected]');
insert into sales values (3, 3, 4, null);
insert into sales values (3, 4, 5, '[email protected]');
SQL> SELECT titles.title_id, title, qty
2 FROM titles LEFT OUTER JOIN sales
3 ON titles.title_id = sales.title_id
4 AND stor_id = 3
5 AND sales.email is not null
6 ;
TITLE_ID TITLE QTY
4 Orange Book 5
3 Blue Book
1 Red Book
2 Yellow Book
SQL>
SQL> SELECT titles.title_id, title, qty
2 FROM titles LEFT OUTER JOIN sales
3 ON titles.title_id = sales.title_id
4 AND 3 = stor_id
5 AND sales.email is not null;
TITLE_ID TITLE QTY
2 Yellow Book 1
4 Orange Book 5
3 Blue Book
1 Red Book
It seems to matter what order I specify the operands stor_id = 3, or 3 = stor_id.
In the older (+) environment, I would understand this, but here? I'm pretty sure most other databases don't care about the order.
thanks for your insight
Kevin

Don't have a 9i around right now to test ... but in 10 ...
SQL> create table titles (title_id int, title varchar(50));
 
Table created.
 
SQL> insert into titles values (1, 'Red Book');
 
1 row created.
 
SQL> insert into titles values (2, 'Yellow Book');
 
1 row created.
 
SQL> insert into titles values (3, 'Blue Book');
 
1 row created.
 
SQL> insert into titles values (4, 'Orange Book');
 
1 row created.
 
SQL> create table sales (stor_id int, title_id int, qty int, email varchar(60));
 
Table created.
 
SQL> insert into sales values (1, 1, 1, '[email protected]');
 
1 row created.
 
SQL> insert into sales values (1, 2, 1, '[email protected]');
 
1 row created.
 
SQL> insert into sales values (3, 3, 4, null);
 
1 row created.
 
SQL> insert into sales values (3, 4, 5, '[email protected]');
 
1 row created.
 
SQL> SELECT titles.title_id, title, qty
  2   FROM titles LEFT OUTER JOIN sales
  3   ON titles.title_id = sales.title_id
  4   AND stor_id = 3
  5   AND sales.email is not null
  6   ;
 
  TITLE_ID TITLE                                                     QTY
         4 Orange Book                                                 5
         3 Blue Book
         1 Red Book
         2 Yellow Book
 
SQL>
SQL> SELECT titles.title_id, title, qty
  2   FROM titles LEFT OUTER JOIN sales
  3   ON titles.title_id = sales.title_id
  4   AND 3 = stor_id
  5   AND sales.email is not null;
 
  TITLE_ID TITLE                                                     QTY
         4 Orange Book                                                 5
         3 Blue Book
         1 Red Book
         2 Yellow Book
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options

Similar Messages

  • Inconsistent results with localtimestamp and current_timestamp

    Running XE on Windows XP with the system timezone to GMT rebooted, restarted XE)
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE     10.2.0.1.0     Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    I'm getting incorrect and inconsistent results with current_timestamp and localtimestamp:
    With SQL, localtimestamp computes the wrong offset (appears to use 1987-2006 DST rules):
    select
    dbtimezone
    , sessiontimezone
    , current_timestamp
    , current_timestamp + numtodsinterval(18,'day') as current_timestamp18
    , localtimestamp
    from dual;
    +00:00     
    US/Eastern     
    17-MAR-10 10.27.17.376000000 AM US/EASTERN     
    04-APR-10 10.27.17.376000000 AM US/EASTERN     
    17-MAR-10 09.27.17.376000000 AM
    however, in PL/SQL, both current_timestamp and localtimestamp return the wrong hour value, and adding 18 to current_timestamp shows it is using 1987-2006 DST rules (1st sunday of april)/ note that this happens in straight PL/SQL and in embedded SQL (same results selecting from tables other than DUAL):
    begin
    for r1 in (
    select
    dbtimezone
    , sessiontimezone
    , current_timestamp
    , current_timestamp + numtodsinterval(18,'day') as current_timestamp18
    , localtimestamp
    from dual
    loop
    dbms_output.put_line('SQL dbtimezone = ' || r1.dbtimezone);
    dbms_output.put_line('SQL sessiontimezone = ' || r1.sessiontimezone);
    dbms_output.put_line('SQL current_timestamp = ' || r1.current_timestamp);
    dbms_output.put_line('SQL current_timestamp +18 = ' || r1.current_timestamp18);
    dbms_output.put_line('SQL localtimestamp = ' || r1.localtimestamp);
    end loop;
    dbms_output.put_line('dbtimezone = ' || dbtimezone);
    dbms_output.put_line('sessiontimezone = ' || sessiontimezone);
    dbms_output.put_line('systimestamp = ' || systimestamp);
    dbms_output.put_line('current_timestamp = ' || current_timestamp);
    dbms_output.put_line('current_timestamp +18 = ' || (current_timestamp + numtodsinterval(18,'day')));
    dbms_output.put_line('localtimestamp = ' || localtimestamp);
    end;
    SQL dbtimezone = +00:00
    SQL sessiontimezone = US/Eastern
    SQL current_timestamp = 17-MAR-10 09.29.32.784000 AM US/EASTERN
    SQL current_timestamp +18 = 04-APR-10 10.29.32.784000000 AM US/EASTERN
    SQL localtimestamp = 17-MAR-10 09.29.32.784000 AM
    dbtimezone = +00:00
    sessiontimezone = US/Eastern
    systimestamp = 17-MAR-10 02.29.32.784000000 PM +00:00
    current_timestamp = 17-MAR-10 09.29.32.784000000 AM US/EASTERN
    current_timestamp +18 = 04-APR-10 10.29.32.784000000 AM US/EASTERN
    localtimestamp = 17-MAR-10 09.29.32.784000000 AM
    dbtimezone = +00:00
    sessiontimezone = US/Eastern
    systimestamp = 17-MAR-10 02.16.21.366000000 PM +00:00
    current_timestamp = 17-MAR-10 09.16.21.366000000 AM US/EASTERN
    current_timestamp +18 = 04-APR-10 10.16.21.366000000 AM US/EASTERN
    localtimestamp = 17-MAR-10 09.16.21.366000000 AM
    is this a known bug?
    is there a patch or a work-around for XE?
    are other datasbase versions affected?

    Can't patch XE, unfortunately it comes with pre-2007 DST rules.
    There is a metalink note describing how to fix the DST changes, and while it's not really a "supported" method, neither is XE- if you can get updated timezone files from a later patch set for the same release, 10gR2, on the right operating system, shutdown/startup the database the updated DST rules will be in place. The timezone files are in $ORACLE_HOME/oracore/zoneinfo.
    Another unfortunately, any values already stored in the database using timestamp with local timezone datatypes for the affected period of the DST changes won't be correct, i.e. there is no 2010-03-14 02:01 (?) but with older timezone rules in place that would be a valid timestamp. The data has to be saved before updating the timezone file, and re-translated to timestamp w/local tz datatypes after the update.
    IMHO storing literal timezone info isn't an ideal practice, let the client settings do the time interpretation, time is always changing. Its the interpretation of the time that gets changed. From time to time. :(

  • Help with sql - Left Join

    Hi,
    Below are the details of what I am attempting to do.
    DB version: 10.2.0.4.0
    Sample Table Definition
    create table t_cnf
    conf_id number,
    conf_value number,
    conf_cat_id number,
    actv_flg    char(1)
    create table t_int_act
    int_acc_id   number,
    frst_mrch_id number,
    create_date  date
    create table t_int_act_cast
    int_acc_id   number,
    cast_id      number
    create t_cast_alt_nmnt
    cas_alt_nmt_id number,
    cas_alt_id     number,
    cast_id        number,
    enrl_flg       char(1),
    src_id         number
    );Sample Data
    insert into t_cnf values (1, 78965098, 12, 'Y');
    insert into t_cnf values (1, 78965098, 13, 'Y');
    insert into t_int_act values (234,78965098, trunc(sysdate) - 1);
    insert into t_int_act_cast values (234, 560432);
    insert into t_cas_alt_nmnt values (1, 2, 560432, 'Y', 2); Need to fetch all cast_ids that are not in t_cast_alt_nmnt or cast_ids that are present in t_cast_alt_nmnt but have t_cast_alt_nmnt.enrl_flg = 'N' and t_cast_alt_nmnt.cast_alt_id in (2,3) and t_cast_alt_nmnt.src_id <> 2
    for t_int_act.frst_mrch_ids matching t_cnf.conf_vale
    Records fetch will insert a record into t_cast_alt_nmnt with css_alt_id 2 or 3 (determined by pe_or_pd).
    I attempted to write below sql. This works fine when cast_id does not exists in t_cast_alt_nmnt but will not return correct results when there is a record in t_cast_alt_nmnt matching above criteria.
    select
        iac.cast_id                            cast_id,
        sysdate                                upd_date,               
        case
            when c.conf_cat_id = 12 then 2
            when c.conf_cat_id = 13 then 3
        end
            pe_or_pd           
    from
        t_cnf                  c
    join    
        t_int_act          ia
    on
        ia.frst_mrch_id = c.conf_value
    join              
        t_int_act_cast iac
    on
        ia.int_acc_id = iac.int_acc_id
    left join       
        t_cast_alt_nmnt     can
    on
        can.cast_id = iac.cast_id     and
        can.enrl_flg = 'N'            and
        can.cas_alt_id in (2,3)       and
        can.src_id <> 2      
    where                 
        c.conf_cat_id              in (12,13)                           and
        c.actv_flg                 = 'Y'                                and
        -- Fetch all new customer created day before.   
        ia.create_date             >= trunc(sysdate) - 1                   
        Expected results
    With no cast_id record in t_cast_alt_nmnt
    cast_id upd_date pe_or_pd
    560432 4/19/2012 2
    560432 4/19/2012 3
    With cast_id record in t_css_alt_nmt (insert provided)
    cast_id upd_date pe_or_pd
    560432 4/19/2012 3
    Appreciate your help
    Edited by: user572194 on Apr 19, 2012 1:04 PM

    Thanks Frank for taking time to look into this and providing sql. I will test is against use cases (mentioned below).
    And I apologize for the typos. I had to change table and column names as it is policy of our company not to post data model details in public forums.
    Requirement:
    1. New cast ids will be added daily and these will get inserted into t_int_act and t_int_act_cas
    2. t_cnf has 2 conf_cat_id configured 12 and 13 and each conf_cat_id will have same conf_values (same as t_int_act.frst_mrch_id) but actv_flg might be different (set to N for 12 and Y for 13). Need to fetch only active ones
    3. t_cas_alt_nmnt will have cast_ids that are enrolled to receive certain mails if enrl_flg is Y for these. Not all cast_ids will have record in this table.
    When a cast_id is enrolled by customer service, a record will get inserted with src_id = 2.
    4. Requirement is to enroll new cast_ids created with frst_mrch_id matching t_cnf.conf_value where conf_cat_id in (12,13)
    Match criteira:
    If t_int_act_cas.cast_id exists in t_cas_alt_nmnt and have enrl_flg = 'Y' for cas_alt_id = 2 then
    insert record with same cast_id, enrl_flg = 'Y' and css_alt_id = 3
    If t_int_act_cas.cast_id exists in t_cas_alt_nmnt and have enrl_flg = 'Y' for cas_alt_id = 3 then
    insert record with same cast_id, enrl_flg = 'Y' and css_alt_id = 2
    If t_int_act_cas.cast_id exists in t_cas_alt_nmnt and have enrl_flg = 'N' for cas_alt_id in (2,3) and src_id = 2 then
    Ignore this record.
    if t_int_act_cas.cast_id not exists in t_cas_alt_nmnt then
    insert 1 record each with cast_id, enrl_flg = 'Y' for css_alt_id 2 and 3
    Hope above explanation makes sense.
    By the way I tried below sql. Yet to test it for all use cases but it worked for the last two.
    Note on PE_OR_PD column. I am just using this column to write separate inserts for css_alt_id 2 and 3.
    select
         cast_id,
         upd_date,
         pe_or_pd
    from    
         (select
                    iac.cast_id                        cast_id,
                    sysdate                            upd_date,
                    case
                        when c.conf_cat_id = 12 and can.cas_alt_id in (2,3) and enrl_flg = 'Y' then null
                        when c.conf_cat_id = 13 and can.cas_alt_id in (2,3) and enrl_flg = 'Y' then null
                        when c.conf_cat_id = 12 and nvl(can.cas_alt_id,2) = 2 and nvl(can.enrl_flg,'Y') = 'N' and can.src_id <> 2 then 'PE'
                        when c.conf_cat_id = 13 and nvl(can.cas_alt_id,3) = 3 and nvl(can.enrl_flg,'Y') = 'N' and can.src_id <> 2 then 'PD'       
                        when c.conf_cat_id = 12 and nvl(can.cas_alt_id,2) = 2 and nvl(can.enrl_flg,'Y') = 'Y' then 'PE'                                                                     
                        when c.conf_cat_id = 13 and nvl(can.cas_alt_id,3) = 3 and nvl(can.enrl_flg,'Y') = 'Y' then 'PD'                                                          
                    end
                        pe_or_pd              
                from
                    t_cnf              c,   
                    t_int_act          ia,      
                    t_intl_act_cus     iac,
                    t_cas_alt_nmnt     can              
                where
                    c.conf_value               = ia.frst_mrch_id               and
                    ia.internal_account_id     = iac.int_act_id                and 
                    can.cast_id(+)             = iac.cast_id                   and                               
                    c.conf_cat_id              in (12,13)                      and
                    c.actv_flg                 = 'Y'                           and
                    -- Fetch all new customer created after last run.   
                    ia.create_date             >= trunc(sysdate) - 1                                                                     
         ) enrl_cust
    where
        pe_or_pd is not null               
                    ;

  • Having issues with a left join, getting ORA-00904 error

    Ok this is something very similar to what I am facing, but dumbed down. None of these columns or tables names exist in real life (Very paranoid company I work for, understandable though) but the fundamental problem I am having is like below.
    Basically I know I could have done something similar to this is MS SQL (Or am I dreaming?). If I am right or wrong I need to know a way around this.
    Obviously if you comment out the "CAL.WEEK_SINCE_2005" and "AND CUST.week_since_2005 = CAL.WEEK_SINCE_2005" it would work. But I really need it to display the date as well. So it can be group'ed by week since 2005.
    I will be joining other statements to this. I am hoping on doing this in one select statement instead of creating multiple tables as I am now. All the other joined tables will follow a VERY similar layout to this. So something like this is need to obtain the look.
    When ran I get the following error.
    I look forward to learning what I did wrong and how I can fix it. :)
    select ORG.ORGANIZATION_NAME,
    CUST.CUST_COUNT,
    CAL.WEEK_SINCE_2005
    FROM organization ORG,
    calendar CAL
    LEFT JOIN (
    SELECT CAP.CURRENT_STORE,
    CALEN.week_since_2005,
    count(CAP.inactive_date) CUST_COUNT
    FROM CUST_AGREE_PAST CAP,
    calendar CALEN
    WHERE CAP.active_date is not null
    and CAP.inactive_code in ('T')
    and CAP.inactive_date between '01-sep-07' and sysdate
    and CAP.INACTIVE_DATE = CALEN.CALENDAR_DATE
    and CAP.RSN_CODE_ID in (select rsn_code_id from reasons where title in ('FAIL', 'NO CALL'))
    GROUP BY CAP.CURRENT_STORE,
    CALEN.week_since_2005) CUST
    ON PO.CURRENT_STORE = ORG.ORGANIZATION_NAME
    AND CUST.week_since_2005 = CAL.WEEK_SINCE_2005

    Just noticed a problem (there might be others):
    FROM organization ORG,
    calendar CAL
    LEFT JOIN (You cannot do that - you are mixing Oracle and ANSI join syntax. You have to do one or the other:
    FROM organization ORG
    JOIN calendar CAL on (ORG.col = CAL.col)
    LEFT JOIN (....)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Inconsistent results with MDX formula

    Hi. I'm converting a BSO cube to ASO, and it has dynamically calculated formulas that I'm converting to MDX. I have a formula that is supposed to accumulate an account (Order Intake) through the months and years until it gets to the current month of the current year (set by substitution variables) and then just carries that balance forward until the end.
    This is the formula I wrote in MDX.
    IIF( Count( Intersect( {MemberRange([Years].[FY95], [&Auto_CurYr].Lag(1))}, {Years.CurrentMember} ) ) = 1,
    IIF(CurrentMember ([Period]) = [Jan],
    [Order Intake] + ([Contract Value],[Adj],[Years].CurrentMember.PrevMember),     
    [Order Intake] + ([Contract Value],[Period].CurrentMember.PrevMember)
    IIF( CurrentMember ([Years]) = [&Auto_CurYr],
    IIF( CurrentMember ([Period]) = [Jan],
    [Order Intake] + ([Contract Value],[Adj],[Years].CurrentMember.PrevMember),
    IIF( Count( Intersect( {MemberRange([Period].[Feb], [&Auto_CurMoNext_01].Lag(1))}, {Period.CurrentMember} ) ) = 1,
    [Order Intake] + ([Contract Value],[Period].CurrentMember.PrevMember),
    ([Contract Value],[Period].CurrentMember.PrevMember)
    ([Contract Value],[Adj],[Years].CurrentMember.PrevMember) /*This is the statement that evaluates for months and years after the current month and year*/
    The inconsistent results are as follows:
    I have a spreadsheet that has the years and months across the top in columns. The substitution variables are set to FY09 for the year and Oct for the month. The formula works fine until it gets to Jan of FY10, at which point it produces a number out of thin air, and carries that incorrect number through to the end.
    When I put the years and months into my rows, however, and then drill down on the months, I get different results. Not only different, but different results at different times, too. When I first drilled, all results were correct. Now when I drill, it produces a random number in October of FY09 (not entirely random, but actually double what it's supposed to be), then #missing in Nov of FY09, then the correct number thereafter. Same exact data intersection on both spreadsheets, different results. I've retrieved over and over again, and the only time it might change is if I re-drill. I've used both Essbase Add-in and Smart View with consistently inconsistent results.
    Has anyone ever encountered this sort of behavior with an MDX formula?

    Well, I finally got a formula that works. I did end up using a combination of CASE and IIF, but I never did figure out how to deal with summing up ranges of data correctly, accounting for changing substitution variables, so I had to do a lot of hard coding by month. For instance, I couldn't ask it to sum([Order Intake],[Jan],[&Auto_CurYr]:([Order Intake],[&Auto_CurMo],[&Auto_CurYr]). Although it validated fine, when I tried to retrieve it said members were not of the same generation, presumably because my substitution variable could potentially be a non - level 0 month (it worked if I hard coded the end month). Also, I really don't like the MDX version of @LSIBLINGS and @RSIBLINGS.
    But this works.
    CASE
    When Count( Intersect( {MemberRange([Years].[FY95], [&Auto_CurYr].Lag(1))}, {Years.CurrentMember} ) ) = 1
    THEN IIF(CurrentMember ([Period]) = [Jan],
    [Order Intake] + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember)),
    IIF(CurrentMember ([Period]) = [Feb],
    Sum(CrossJoin({[Order Intake]}, {[Jan]:[Feb]})) + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember)),
    IIF(CurrentMember ([Period]) = [Mar],
    Sum(CrossJoin({[Order Intake]}, {[Jan]:[Mar]})) + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember)),
    IIF(CurrentMember ([Period]) = [Apr],
    Sum(CrossJoin({[Order Intake]}, {[Jan]:[Apr]})) + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember)),
    IIF(CurrentMember ([Period]) = [May],
    Sum(CrossJoin({[Order Intake]}, {[Jan]:[May]})) + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember)),
    IIF(CurrentMember ([Period]) = [Jun],
    Sum(CrossJoin({[Order Intake]}, {[Jan]:[Jun]})) + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember)),
    IIF(CurrentMember ([Period]) = [Jul],
    Sum(CrossJoin({[Order Intake]}, {[Jan]:[Jul]})) + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember)),
    IIF(CurrentMember ([Period]) = [Aug],
    Sum(CrossJoin({[Order Intake]}, {[Jan]:[Aug]})) + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember)),
    IIF(CurrentMember ([Period]) = [Sep],
    Sum(CrossJoin({[Order Intake]}, {[Jan]:[Sep]})) + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember)),
    IIF(CurrentMember ([Period]) = [Oct],
    Sum(CrossJoin({[Order Intake]}, {[Jan]:[Oct]})) + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember)),
    IIF(CurrentMember ([Period]) = [Nov],
    Sum(CrossJoin({[Order Intake]}, {[Jan]:[Nov]})) + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember)),
    Sum(CrossJoin({[Order Intake]}, {[Jan]:[Dec]})) + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember))
    When CurrentMember ([Years]) IS [&Auto_CurYr]
    THEN IIF(CurrentMember ([Period]) = [Jan],
    [Order Intake] + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember)),
    IIF(CurrentMember ([Period]) = [Feb] AND CONTAINS([Feb], {MEMBERRANGE([&Auto_CurMoNext_01].FirstSibling, [&Auto_CurMoNext_01].Lag(1))}),
    Sum(CrossJoin({[Order Intake]}, {[Jan]:[Feb]})) + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember)),
    IIF(CurrentMember ([Period]) = [Mar] AND CONTAINS([Mar], {MEMBERRANGE([&Auto_CurMoNext_01].FirstSibling, [&Auto_CurMoNext_01].Lag(1))}),
    Sum(CrossJoin({[Order Intake]}, {[Jan]:[Mar]})) + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember)),
    IIF(CurrentMember ([Period]) = [Apr] AND CONTAINS([Apr], {MEMBERRANGE([&Auto_CurMoNext_01].FirstSibling, [&Auto_CurMoNext_01].Lag(1))}),
    Sum(CrossJoin({[Order Intake]}, {[Jan]:[Apr]})) + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember)),
    IIF(CurrentMember ([Period]) = [May] AND CONTAINS([May], {MEMBERRANGE([&Auto_CurMoNext_01].FirstSibling, [&Auto_CurMoNext_01].Lag(1))}),
    Sum(CrossJoin({[Order Intake]}, {[Jan]:[May]})) + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember)),
    IIF(CurrentMember ([Period]) = [Jun] AND CONTAINS([Jun], {MEMBERRANGE([&Auto_CurMoNext_01].FirstSibling, [&Auto_CurMoNext_01].Lag(1))}),
    Sum(CrossJoin({[Order Intake]}, {[Jan]:[Jun]})) + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember)),
    IIF(CurrentMember ([Period]) = [Jul] AND CONTAINS([Jul], {MEMBERRANGE([&Auto_CurMoNext_01].FirstSibling, [&Auto_CurMoNext_01].Lag(1))}),
    Sum(CrossJoin({[Order Intake]}, {[Jan]:[Jul]})) + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember)),
    IIF(CurrentMember ([Period]) = [Aug] AND CONTAINS([Aug], {MEMBERRANGE([&Auto_CurMoNext_01].FirstSibling, [&Auto_CurMoNext_01].Lag(1))}),
    Sum(CrossJoin({[Order Intake]}, {[Jan]:[Aug]})) + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember)),
    IIF(CurrentMember ([Period]) = [Sep] AND CONTAINS([Sep], {MEMBERRANGE([&Auto_CurMoNext_01].FirstSibling, [&Auto_CurMoNext_01].Lag(1))}),
    Sum(CrossJoin({[Order Intake]}, {[Jan]:[Sep]})) + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember)),
    IIF(CurrentMember ([Period]) = [Oct] AND CONTAINS([Oct], {MEMBERRANGE([&Auto_CurMoNext_01].FirstSibling, [&Auto_CurMoNext_01].Lag(1))}),
    Sum(CrossJoin({[Order Intake]}, {[Jan]:[Oct]})) + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember)),
    IIF(CurrentMember ([Period]) = [Nov] AND CONTAINS([Nov], {MEMBERRANGE([&Auto_CurMoNext_01].FirstSibling, [&Auto_CurMoNext_01].Lag(1))}),
    Sum(CrossJoin({[Order Intake]}, {[Jan]:[Nov]})) + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember)),
    Sum(CrossJoin({[Order Intake]}, {[Jan]:[&Auto_CurMo]})) + sum(([Order Intake],[YearTotal],[FY95]):([Order Intake],[YearTotal],[Years].CurrentMember.PrevMember))
    WHEN CONTAINS([Years].CurrentMember, {MemberRange([&Auto_CurYr].Lead(1), [Years].[FY15])})
    THEN ([Contract Value],[Adj],[Years].&Auto_CurYr)
    END
    Thanks for looking at it, Gary, I appreciate it.
    Sabrina
    Edited by: SabrinaD on Nov 18, 2009 2:29 PM
    Edited by: SabrinaD on Nov 18, 2009 2:31 PM
    Edited by: SabrinaD on Nov 18, 2009 2:34 PM
    Edited by: SabrinaD on Nov 18, 2009 2:35 PM

  • Don'T repeat item with a LEFT JOIN QUERY

    Hello,
    I would like to know how display the following results:
    *Name*:  John Fox
    *Sales:*  1- LAPTOP
                    2- HARDDRIVE
                    3- COMPUTERHere is my 2 tables: CUSTOMER and SALES
    CUSTOMER
    ID NAME GENDER
    1 John Mayer F
    2 Melissa John F
    3 Julie Black F
    4 Mickael Fox M
    5 John Fox M
    SALES
    ID ID_CUSTOMER TYPE
    1 1 Boat
    2 1 TV
    3 4 CD PLAYER
    4 5 LAPTOP
    5 5 HARDDRIVE
    6 5 COMPUTER
    My QUERY
    SELECT customer.Name as NAME, customer.Gender, sales.TYPE
    from customer
    LEFT JOIN sales
    ON customer.ID = sales.ID_CUSTOMER
    WHERE customer.Name = 'John Fox'The problem: If I use the default template, I have:
    NAME GENDER TYPE
    John Fox M LAPTOP
    John Fox M HARDDRIVE
    John Fox M COMPUTER I don'T want the Name John Fox to be repeated at each row.
    I tried to add: #Name# in the REGION DEFINITION - REGION HEADER but I have this result:
    #NAME#
    NAME GENDER TYPE
    John Fox M LAPTOP
    John Fox M HARDDRIVE
    John Fox M COMPUTER
    So, what can I do to have this result? Change the query???
    Name:  John Fox
    Sales: 1- LAPTOP
           2- HARDDRIVE
            3- COMPUTER               thanks,
         Roseline

    Hi Roseline,
    You can adapt the solution suggested in this post Re: More than 1 records in one cell
    Thanks,
    Manish

  • Inconsistent results with "Apply" commit

    Ever since using PPR event to filter MessageChoice results, I've been experiencing lag when trying to commit data. But the lag is only every other time I commit data!
    Here are execution times and when the confirmation page appears (in order):
    1. 10 sec
    2. 1.5 min
    3. 12 sec
    4. 1.75 min
    5. 8 sec
    6. 1.6 min
    7. 7 sec
    8. 1.65 min
    9. 6 sec
    Why is it that every other execution is an acceptable execution time and the others are not. No code was change between each execution time. Anyone else experience this?
    Thanks,
    -Scott

    Can't patch XE, unfortunately it comes with pre-2007 DST rules.
    There is a metalink note describing how to fix the DST changes, and while it's not really a "supported" method, neither is XE- if you can get updated timezone files from a later patch set for the same release, 10gR2, on the right operating system, shutdown/startup the database the updated DST rules will be in place. The timezone files are in $ORACLE_HOME/oracore/zoneinfo.
    Another unfortunately, any values already stored in the database using timestamp with local timezone datatypes for the affected period of the DST changes won't be correct, i.e. there is no 2010-03-14 02:01 (?) but with older timezone rules in place that would be a valid timestamp. The data has to be saved before updating the timezone file, and re-translated to timestamp w/local tz datatypes after the update.
    IMHO storing literal timezone info isn't an ideal practice, let the client settings do the time interpretation, time is always changing. Its the interpretation of the time that gets changed. From time to time. :(

  • Inconsistent results with Windows App Certification Kit

    Hi, I asked about this issue before on a different forum but didn't get a response. Support pointed me towards this forum so I'm asking here as maybe the other forum wasn't the appropriate one. My company is attempting to renew our ms partnership, and we are
    trying to certify our desktop
    app for windows 8. I have attached a screen shot below showing the registry entries that our app makes. When we try to test for certification (windows 8) we get the different (but similar) results on different systems using the exact same installation package.
    Here is an example of the results we get:
    Results:
    An optional value 'VersionMajor' is missing or invalid      for program Chiro8000.
    An optional value 'VersionMinor' is missing or invalid      for program Chiro8000.
    An optional value 'MajorVersion' is missing or invalid      for program Chiro8000.
    An optional value 'MinorVersion' is missing or invalid      for program Chiro8000.
    A non-optional value 'DisplayName' is missing or      invalid for program Chiro8000.
    A non-optional value 'Publisher' is missing or invalid      for program Chiro8000.
    A non-optional value 'ProductVersion' is missing or      invalid for program Chiro8000.
    An optional value 'InstallLocation' is missing or      invalid for program Chiro8000.
    Can anyone point us in the right direction?

    How did you publish this package? Here are some similar questions, maybe caused by installer:
    http://stackoverflow.com/questions/21182856/windows-app-certification-kit-test-result-app-didnt-create-the-require-regist
    http://www.advancedinstaller.com/forums/viewtopic.php?f=2&t=21368
    http://www.advancedinstaller.com/forums/viewtopic.php?f=2&t=29782
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/e61c393d-e5af-4fee-ad8b-29c36e889043/windows-app-certification-kit-tests-fail-for-desktop-app-installed-from-msi?forum=windowscompatibility
    Best Regards,
    Please remember to mark the replies as answers if they help

  • Inconsistent results with SDO_RELATE and boundary conditions

    Hello,
    I am using SDO_RELATE to find all points in one table with any interaction with a polygon selected from a second table. Pretty basic stuff. I noticed one point which exactly matches a vertex on the query polygon was not getting selected as expected. Experimenting a bit I found if I embedded the polygon geometry in the query (rather than selecting it from its table) the query selected the point in question! Experimenting further I found if I changed the query relation from ANYINTERACT to TOUCH the point in question was not selected. So my 2 questions are:
    1) What would cause this to fail when the query polygon is being selected from the table?
    2) How can ANYINTERACT be true but TOUCH be false?
    Here is the first query that fails:
    SELECT a.point_id
    FROM point_table a, poly_table b
    WHERE a.point_id = <point which matches poly vertex>
    AND b.poly_id = <poly_id>
    AND SDO_RELATE (a.geom, b.geom, 'mask=ANYINTERACT querytype=WINDOW') = 'TRUE';
    Here is the query that works:
    SELECT a.point_id
    FROM point_table a, poly_table b
    WHERE a.point_id = <point which matches poly vertex>
    AND SDO_RELATE (a.geom,
    MDSYS.SDO_GEOMETRY(2003, 8265, NULL,
    MDSYS.SDO_ELEM_INFO_ARRAY(1, 1003, 1),
    MDSYS.SDO_ORDINATE_ARRAY(-82.414884, 28.0094323,
    -82.387158, 28.0116258, -82.378891, 28.0131216,
    -82.377988, 28.0133894, -82.37555, 28.0143994,
    -82.329352, 28.0661089, -82.313207, 28.1006725,
    -82.362246, 28.1261981, -82.445319, 28.1139363,
    -82.428389, 28.0245891, -82.422103, 28.0117697,
    -82.421382, 28.0109085, -82.419096, 28.0099741,
    -82.414884, 28.0094323)),
    'mask=ANYINTERACT querytype=WINDOW') = 'TRUE';
    Here is the second query that fails (ANYINTERACT -> TOUCH):
    SELECT a.point_id
    FROM point_table a, poly_table b
    WHERE a.point_id = <point which matches poly vertex>
    AND SDO_RELATE (a.geom,
    MDSYS.SDO_GEOMETRY(1003, 8265, NULL,
    MDSYS.SDO_ELEM_INFO_ARRAY(1, 2003, 1),
    MDSYS.SDO_ORDINATE_ARRAY(-82.414884, 28.0094323,
    -82.387158, 28.0116258, -82.378891, 28.0131216,
    -82.377988, 28.0133894, -82.37555, 28.0143994,
    -82.329352, 28.0661089, -82.313207, 28.1006725,
    -82.362246, 28.1261981, -82.445319, 28.1139363,
    -82.428389, 28.0245891, -82.422103, 28.0117697,
    -82.421382, 28.0109085, -82.419096, 28.0099741,
    -82.414884, 28.0094323)),
    'mask=TOUCH querytype=WINDOW') = 'TRUE';
    The point geometry being selected from the point_table looks like this:
    MDSYS.SDO_GEOMETRY(2001, 8265, NULL,
    MDSYS.SDO_ELEM_INFO_ARRAY(1, 1, 1),
    MDSYS.SDO_ORDINATE_ARRAY(-82.445319, 28.1139363))
    The metadata for these 2 tables looks like this:
    POINT_TABLE
    GEOM
    SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X', -180, 180, .05),
    SDO_DIM_ELEMENT('Y', -90, 90, .05))
    8265
    POLY_TABLE
    GEOM
    SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X', -180, 180, .05),
    SDO_DIM_ELEMENT('Y', -90, 90, .05))
    8265
    Both tables have R-tree indexes built.
    System is Oracle9i Enterprise Edition Release 9.2.0.5.0 with sdo_version = 9.2.0.5.0
    Is it a problem that my points are stored as SDO_ORDINATES? Is the tolerance a factor? Is geodetic data a factor?
    Let me know if any other information would be useful and thank you for your help!
    James

    I am continuing to struggle with this one. I gave up on the SDO_RELATE function under the assumption the tolerance does not come into play for this function (is this true?).
    Now I am trying to use the SDO_GEOM.RELATE function with a tolerance to make this work and it is not working as I would expect.
    The following 2 queries show the distance between this point and this polygon is 0 yet they are disjoint. How can this be??
    Thanks, James
    SQL> SELECT SDO_GEOM.SDO_DISTANCE(
    2 MDSYS.SDO_GEOMETRY(2001, 8265, NULL,
    3 MDSYS.SDO_ELEM_INFO_ARRAY(1, 1, 1),
    4 MDSYS.SDO_ORDINATE_ARRAY(-82.445319, 28.1139363)),
    5 MDSYS.SDO_GEOMETRY(2003, 8265, NULL,
    6 MDSYS.SDO_ELEM_INFO_ARRAY(1, 1003, 1),
    7 MDSYS.SDO_ORDINATE_ARRAY(-82.414884, 28.0094323, -82.387158, 28.0116258,
    8 -82.378891, 28.0131216, -82.377988, 28.0133894, -82.37555, 28.0143994,
    9 -82.329352, 28.0661089, -82.313207, 28.1006725, -82.362246, 28.1261981,
    10 -82.4453185022412,28.1139363297581, -82.428389, 28.0245891, -82.422103, 28.0117697,
    11 -82.421382, 28.0109085, -82.419096, 28.0099741, -82.414884, 28.0094323)),
    12 10)
    13 FROM DUAL;
    SDO_GEOM.SDO_DISTANCE(MDSYS.SDO_GEOMETRY(2001,8265,NULL,MDSYS.SDO_ELEM_INFO_ARRA
    .00000000000000000000
    SQL>
    SQL> SELECT SDO_GEOM.RELATE(
    2 MDSYS.SDO_GEOMETRY(2001, 8265, NULL,
    3 MDSYS.SDO_ELEM_INFO_ARRAY(1, 1, 1),
    4 MDSYS.SDO_ORDINATE_ARRAY(-82.445319, 28.1139363)),
    5 'determine',
    6 MDSYS.SDO_GEOMETRY(2003, 8265, NULL,
    7 MDSYS.SDO_ELEM_INFO_ARRAY(1, 1003, 1),
    8 MDSYS.SDO_ORDINATE_ARRAY(-82.414884, 28.0094323, -82.387158, 28.0116258,
    9 -82.378891, 28.0131216,-82.377988, 28.0133894, -82.37555, 28.0143994,
    10 -82.329352, 28.0661089, -82.313207, 28.1006725,
    11 -82.362246, 28.1261981, -82.4453185022412, 28.1139363297581,
    12 -82.428389, 28.0245891, -82.422103, 28.0117697,
    13 -82.421382, 28.0109085, -82.419096, 28.0099741, -82.414884, 28.0094323)),
    14 10)
    15 FROM DUAL;
    SDO_GEOM.RELATE(MDSYS.SDO_GEOMETRY(2001,8265,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1,
    DISJOINT

  • Inconsistent Results with Email Export?

    I've set up my presets so that when I export to Mail via the Mail icon my images should be reduced in size/res and watermarks should be added. This is working fine on direct exports but not when export to mail? My images aren't being resized or watermarked?
    Here's the way I have it setup: Aperture/Presets/Image Export/Email Medium-JPEG/Show Watermark is checked, as is Scale Watermark. I've also created a custom preset which is basically identical but still no dice. As I said Export works fine when exporting to a folder. Is there another way to set this up? Am I missing something? Anyone else having this issue?

    Can't patch XE, unfortunately it comes with pre-2007 DST rules.
    There is a metalink note describing how to fix the DST changes, and while it's not really a "supported" method, neither is XE- if you can get updated timezone files from a later patch set for the same release, 10gR2, on the right operating system, shutdown/startup the database the updated DST rules will be in place. The timezone files are in $ORACLE_HOME/oracore/zoneinfo.
    Another unfortunately, any values already stored in the database using timestamp with local timezone datatypes for the affected period of the DST changes won't be correct, i.e. there is no 2010-03-14 02:01 (?) but with older timezone rules in place that would be a valid timestamp. The data has to be saved before updating the timezone file, and re-translated to timestamp w/local tz datatypes after the update.
    IMHO storing literal timezone info isn't an ideal practice, let the client settings do the time interpretation, time is always changing. Its the interpretation of the time that gets changed. From time to time. :(

  • Inconsistent Results with Flash Using Different Monitors

    Hi Folks,
    I hope this is the correct forum for this question. If not, let me know where to post it.
    We do a lot of flash on DotNetNuke web sites. Strange combination? Maybe. At any rate we have had reasonable success but recently ran into a strange issue. Maybe it isn’t so strange for graphics gurus who really know a lot about things like aspect ratios, display resolution and various types of monitors but it was for us. We finally fixed our problem but not to my satisfaction because I don’t fully understand why what we did worked. Maybe someone on this forum more expert than me can provide some knowledge. I would really appreciate it. I always like to increase my knowledge base.
    We had three Flash movie modules on a web page displayed via three DNN media modules. We do that all the time. However this time the center one was skewed or pushed over several inches to the right on a customer laptop and on one of our machines running Vista. It appeared to be specific to IE 8 but we didn’t do a lot of testing on other browsers. Every other machine we had looked OK. I had other folks look at the site but no one had the skewing issue.
    From the testing we did do the issues appear to break down into two problems. The skewing on our Vista machine was corrected by reinstalling IE 8. This I guess was do to some installation problem when IE 8 was first installed.
    Our customer however still had this problem with Win XP even after reinstalling IE 8 and he claimed the same problem existed on a new Win 7 machine with IE 8. We managed to get a laptop running Win XP and IE 8 with a monitor that we thought was like the one the customer was using. Sure enough we got the skewing problem. Reinstalling IE 8 made no difference as it did with our Vista machine. We then played with the actual size (height and width) of the Flash movie modules and the DNN media modules by trial and error until the skewing disappeared on the laptop. Everything now displays OK on all monitors that we have tested including all the customer’s machines. This appears to have something to do with the aspect ratio and the Flash player. I don’t believe in magic. There has to be a mathematical technical explanation for this but I don’t have the expertise to know exactly what it is.
    Any help would be much appreciated. If there are any books, documents, or other material that will eliminate my ignorance please indicate what they are.
    Thanks,
    G. M.

    Can't patch XE, unfortunately it comes with pre-2007 DST rules.
    There is a metalink note describing how to fix the DST changes, and while it's not really a "supported" method, neither is XE- if you can get updated timezone files from a later patch set for the same release, 10gR2, on the right operating system, shutdown/startup the database the updated DST rules will be in place. The timezone files are in $ORACLE_HOME/oracore/zoneinfo.
    Another unfortunately, any values already stored in the database using timestamp with local timezone datatypes for the affected period of the DST changes won't be correct, i.e. there is no 2010-03-14 02:01 (?) but with older timezone rules in place that would be a valid timestamp. The data has to be saved before updating the timezone file, and re-translated to timestamp w/local tz datatypes after the update.
    IMHO storing literal timezone info isn't an ideal practice, let the client settings do the time interpretation, time is always changing. Its the interpretation of the time that gets changed. From time to time. :(

  • Inconsistent results using the "places" view on the iPad with geotagged photos

    I am getting inconsistent results with geotagged photos on the iPad (both 1 and 2) OS 5.01.  It seems that sometime photos will show up in the correct location on the places view others will not ( they will not show up at all).  In fact I can have a geotagged photo in one folder, synch with iTunes and it will not show up in the places view and then move that same picture to a different folder (which becomes an album on the iPad) re-synch and it will now show up at the correct location in the places view.  All photos show up in the album view.  Everything is the latest version iTunes, iPad etc.  I can also have many photos geotagged exactly to the same location (exact same coordinates) some will show up, others will not.
    I have used different methods to geotag my photos.  At first I was using Photoshop Elements 8 until they stopped supporting geotagging photos.  Now I am using a third party application GeoSetter (excellent free application).  The GPS data is clearly in the Exif data but the results are not consistent.
    Any ideas? 

    I believe I have solved this problem myself and thought others might benefit from what I found.  It turns out to be what I believe as a glitch in iTunes.  iTunes creates a cache of all the photos that you synch with your iPad, iPhone etc.  Apparently it does not update that cache when you change the photo.  At least not the Geotagging data.  The file modify date was changing but that wasn't enough to cause iTunes to update the cache of the photos.  I deleted the cache of all the photos and re-synched and presto now all my photos where showing up at the correct location in the iPad "places" view.
    I might add that I called Apple tech support and was routed to a higher tier support person and was very disappointed with his response.  He basically told me that the "place" view in the iPad and iPhone was designed to be only used with an Apple computer and Apple software and was surprised the places view was working at all with pictures synched with a Windows based machine.  He also said he was unable to help me since he couldn't provide support for non-Apple products.  Although I understand this to a point I think he was too quick to make this decision.  The solution after all was a simple one and one I think he should have known.  I would think this cache problem would happen whether I was using Apple products as well.  I view this as a bug in iTunes.  Apple needs to compare the modified date of the file and update the cache if it has changed.

  • How to make a customize form with optional parameter and left join

    Hi,
    I am trying to make a report with a left join. I also want ot have optional parameters in it.
    I am using the Create Reports From SQL Query method:
    SQL is :
    select ename, sal
    from scott.emp left join scott.dept
    on scott.emp.deptno = scott.dept.deptno
    where sal >= :lower_sal
    and sal <= :higher_sal;
    However, if I do it this way, I those 2 parameters are not optional.... How can I make them optional?
    If I use the Create Reports From Query Wizard method, I can make the parameters optional, but then I cannot do the left join...
    Thanks,
    Wilson

    hi,
    to catch null values on both sides I use:
    where nvl(sal,0) >= nvl(:lower_sal,nvl(sal,0))
    and nvl(sal,0) <= nvl(:higher_sal,9999999999)
    otherwise there will be no rows in the report where the value of sal is null, even if there are no selection criteria entered.
    regards Michael

  • Multi-Left Join Query Tuning

    I am tuning a SELECT query with 36 Left Joins in addition to normal Inner Joins and a View.
    I have used the RESULT_CACHE hint with some success.
    I have tried the LEADING hint and USE_MERGE with no success.
    Is there an Undocumented HINT and that may assist me?
    Thanks
    BRAD

    Hi, Brad,
    Welcome to the forum!
    970109 wrote:
    I am tuning a SELECT query with 36 Left Joins in addition to normal Inner Joins and a View.Why does the query need so many outer joins? Could there be a bad table design behind this problem? Post a simplified version ot the problem (with maybe 3 tables that need to be outer-joined). Post CREATE TABLE and INSERT statements for a little sample data (relevant columns only), the results you want from that sample data, and an explanation of how you get those results from that data.
    See the forum FAQ {message:id=9360002}
    For all tuning problems, see {message:id=9360003}

  • OWB 10.2.0.4 ANSI SQL join problem

    Hi
    Its seams to me, that in OWB 10.2.0.4 there is something broken with ANSI SQL joins and instead of ANSI joins there is used oracle SQL joins only. Maybe someone can point some solutions? I can’t rewrite all mappings with union and other operators. And manually pl/sql editing also would be big problem.

    "Am I correct in assuming you did not code ANSI joins?" -> yes, i am coding Oracle SQL joins and with this option just generating ANSI joins.
    With ANSI SQL join you can use OR and IN operands (and code looks more readable).
    It is question of performance (so for example 80% of dataset you can join by one column other 15% by second etc ..). So this all can be rewritten also in Split->join->union all, but if you have several such joins, this will be painfully.

Maybe you are looking for