Performance issue when using the same query in a different way

Hello,
I have a performance problem with the statement below when running it with an insert or with execute immediate.
n.b.: This statement could be more optimized, but it is a generated statement.
When I run this statement I get one row back within one second, so there is no performance problem.
   select  sysdate
         ,5
         ,'testje'
         ,count (1)
         ,'NL' groupby
   from   (select 'different (target)' compare_type
                   ,t.id_org_addr id_org_addr -- ID_ORG_ADDR
                   ,t.vpd_country vpd_country -- CTL_COUNTRY
                   ,t.addr_type addr_type -- ADDRESSTYP_COD
             from   (select *
                     from   (select t.*
                             from      ods.ods_org_addr t
                                    left outer join
                                       m_sy_foreign_key m
                                    on m.vpd_country = t.vpd_country
                                    and m.key_type = 'ORGADDR2'
                                    and m.target_value = t.id_org_addr
                             where  coalesce (t.end_date, to_date ('99991231', 'yyyymmdd')) >= sysdate) /*SGRB*/
                     where  vpd_country = 'NL' /*EGRB*/
                                              ) t
             where  exists
                       (select null
                        from   (select *
                                from   (select m.target_value id_org_addr
                                              ,s.wkp_id_cegedim || '-' || s.adr_id_cegedim || '-' || s.addresstyp_cod id_cegedim
                                              ,s.*
                                        from      okc_mdl_workplace_address s
                                               left outer join
                                                  m_sy_foreign_key m
                                               on m.vpd_country = s.ctl_country
                                               and m.key_type = 'ORGADDR2'
                                               and m.source_value = s.wkp_id_cegedim || '-' || s.adr_id_cegedim || '-' || s.addresstyp_cod
                                        where  coalesce (s.end_val_dat, to_date ('99991231', 'yyyymmdd')) >= sysdate) /*SGRB*/
                                where  ctl_country = 'NL' /*EGRB*/
                                                         ) s
                        where  t.id_org_addr = s.id_org_addr)
             minus
             select 'different (target)' compare_type
                   ,s.id_org_addr id_org_addr -- ID_ORG_ADDR
                   ,s.ctl_country vpd_country -- CTL_COUNTRY
                   , (select to_number (l.target_value)
                      from   okc_code_foreign l
                      where  l.source_code_type = 'TYS'
                      and    l.target_code_type = 'ADDRLINKTYPE'
                      and    l.source_value = upper (s.addresstyp_cod)
                      and    l.vpd_country = s.ctl_country)
                       addr_type -- ADDRESSTYP_COD
             from   (select *
                     from   (select m.target_value id_org_addr
                                   ,s.wkp_id_cegedim || '-' || s.adr_id_cegedim || '-' || s.addresstyp_cod id_cegedim
                                   ,s.*
                             from      okc_mdl_workplace_address s
                                    left outer join
                                       m_sy_foreign_key m
                                    on m.vpd_country = s.ctl_country
                                    and m.key_type = 'ORGADDR2'
                                    and m.source_value = s.wkp_id_cegedim || '-' || s.adr_id_cegedim || '-' || s.addresstyp_cod
                             where  coalesce (s.end_val_dat, to_date ('99991231', 'yyyymmdd')) >= sysdate) /*SGRB*/
                     where  ctl_country = 'NL' /*EGRB*/
                                              ) s) When I run this statement using a insert by placing
insert into okc_compare_results (
               datetime
              ,compare_tables_id
              ,compare_target
              ,record_count
              ,groupby
            ) before the statement, then the statement runs about *3 to 4 minutes*, The same is happening when running the select part only using execute immediate.
Below the execution plans of the insert with the select and the select only.
Could somebody tell me what causes the different behavior of the "same" statement and what could I do to avoid this behavior.
The database version is: 11.1.0.7.0
Regards,
Fred.
SQL Statement which produced this data:
  select * from table(dbms_xplan.display_cursor ('cuk3uwnxx344q',0 /*3431532430 */))
  union all
  select * from table(dbms_xplan.display_cursor ('862aq599gfd6n',0/*3531428851 */))
plan_table_output
SQL_ID  cuk3uwnxx344q, child number 0
select sysdate          ,:"SYS_B_00"          ,:"SYS_B_01"          
,count (:"SYS_B_02")          ,:"SYS_B_03" groupby    from   ( (select
:"SYS_B_04" compare_type                    ,t.id_org_addr id_org_addr
-- ID_ORG_ADDR                    ,t.vpd_country vpd_country --
CTL_COUNTRY                    ,t.addr_type addr_type -- ADDRESSTYP_COD
             from   (select *                      from   (select t.*   
                           from      ods.ods_org_addr t                 
                    left outer join                                     
   m_sy_foreign_key m                                     on
m.vpd_country = t.vpd_country ;                                    and
m.key_type = :"SYS_B_05"                                     and
m.target_value = t.id_org_addr ;                             where  
coalesce (t.end_date, to_date (:"SYS_B_06", :"SYS_B_07")) >= sysdate)
/*SGRB*/                      where  vpd_country = :"SYS_B_08" /*EGRB*/
Plan hash value: 3431532430
Id   Operation                                  Name                       Rows   Bytes Cost (%CPU) Time      Pstart Pstop
0 SELECT STATEMENT                                                                         1772 (100)                           
1   SORT AGGREGATE                                                        1                                                
2    VIEW                                                                 3           1772   (1) 00:00:22                
3     MINUS                                                                                                                      
4      SORT UNIQUE                                                        3 492   1146   (1) 00:00:14                
*  5       HASH JOIN OUTER                                                   3 492   1145   (1) 00:00:14                
6        NESTED LOOPS                                                                                                            
7         NESTED LOOPS                                                    3 408    675   (1) 00:00:09                
*  8          HASH JOIN                                                      42 4242    625   (1) 00:00:08                
9           PARTITION LIST SINGLE                                         3375    148K    155   (2) 00:00:02    KEY    KEY
* 10            TABLE ACCESS FULL                OKC_MDL_WORKPLACE_ADDRESS 3375    148K    155   (2) 00:00:02    KEY    KEY
* 11           INDEX RANGE SCAN                  PK_M_SY_FOREIGN_KEY        49537   2709K    469   (1) 00:00:06                
* 12          INDEX UNIQUE SCAN                  UK_ODS_ORG_ADDR            1              1   (0) 00:00:01                
* 13         TABLE ACCESS BY GLOBAL INDEX ROWID ODS_ORG_ADDR               1 35      2   (0) 00:00:01 ROWID ROWID
* 14        INDEX RANGE SCAN                     PK_M_SY_FOREIGN_KEY        49537   1354K    469   (1) 00:00:06                
15      NESTED LOOPS                                                                                                              
16       NESTED LOOPS                                                      1 67      9  (12) 00:00:01                
17        NESTED LOOPS                                                     1 48      8  (13) 00:00:01                
* 18         HASH JOIN                                                       1 23      6  (17) 00:00:01                
* 19          TABLE ACCESS BY GLOBAL INDEX ROWID ODS_COUNTRY_SYSTEM         1 11      2   (0) 00:00:01 ROWID ROWID
* 20           INDEX RANGE SCAN                  PK_ODS_DIVISION_SYSTEM     1              1   (0) 00:00:01                
* 21          TABLE ACCESS FULL                  SY_SOURCE_CODE             8 96      3   (0) 00:00:01                
22         TABLE ACCESS BY INDEX ROWID         SY_FOREIGN_CODE            1 25      2   (0) 00:00:01                
* 23          INDEX RANGE SCAN                   PK_SY_FOREIGN_CODE         1              1   (0) 00:00:01                
* 24        INDEX UNIQUE SCAN                    PK_SY_TARGET_CODE          1              0   (0)                           
* 25       TABLE ACCESS BY INDEX ROWID           SY_TARGET_CODE             1 19      1   (0) 00:00:01                
26      SORT UNIQUE                                                        3375    332K    626   (1) 00:00:08                
* 27       HASH JOIN OUTER                                                   3375    332K    625   (1) 00:00:08                
28        PARTITION LIST SINGLE                                            3375    148K    155   (2) 00:00:02    KEY    KEY
* 29         TABLE ACCESS FULL                   OKC_MDL_WORKPLACE_ADDRESS 3375    148K    155   (2) 00:00:02    KEY    KEY
* 30        INDEX RANGE SCAN                     PK_M_SY_FOREIGN_KEY        49537   2709K    469   (1) 00:00:06                
Predicate Information (identified by operation id):
   5 - access("M"."TARGET_VALUE"="T"."ID_ORG_ADDR" AND "M"."VPD_COUNTRY"="T"."VPD_COUNTRY")
   8 - access("M"."SOURCE_VALUE"="S"."WKP_ID_CEGEDIM" :SYS_B_12 S."ADR_ID_CEGEDIM" :SYS_B_13 S."ADDRESSTYP_COD" AND
              "M"."VPD_COUNTRY"="S"."CTL_COUNTRY")
  10 - filter(COALESCE("S"."END_VAL_DAT",TO_DATE(:SYS_B_14,:SYS_B_15))>=SYSDATE@!)
  11 - access("M"."KEY_TYPE"=:SYS_B_11 AND "M"."VPD_COUNTRY"=:SYS_B_16)
  12 - access("T"."ID_ORG_ADDR"="M"."TARGET_VALUE")
  13 - filter(("T"."VPD_COUNTRY"=:SYS_B_08 AND COALESCE("T"."END_DATE",TO_DATE(:SYS_B_06,:SYS_B_07))>=SYSDATE@!))
  14 - access("M"."KEY_TYPE"=:SYS_B_05 AND "M"."VPD_COUNTRY"=:SYS_B_08)
  18 - access("CS"."ID_SYSTEM"="SK"."ID_SOURCE_SYSTEM")
  19 - filter("CS"."SYSTEM_TYPE"=1)
  20 - access("CS"."VPD_COUNTRY"=:B1 AND "CS"."EXP_IMP_TYPE"='I')
       filter("CS"."EXP_IMP_TYPE"='I')
  21 - filter("SK"."CODE_TYPE"=:SYS_B_18)
  23 - access("FK"."ID_SOURCE_CODE"="SK"."ID_SOURCE_CODE" AND "FK"."SOURCE_VALUE"=UPPER(:B1) AND
              "CS"."VPD_COUNTRY"="FK"."VPD_COUNTRY")
       filter(("FK"."VPD_COUNTRY"=:B1 AND "FK"."SOURCE_VALUE"=UPPER(:B2) AND "CS"."VPD_COUNTRY"="FK"."VPD_COUNTRY"))
  24 - access("FK"."ID_TARGET_CODE"="TK"."ID_TARGET_CODE")
  25 - filter("TK"."CODE_TYPE"=:SYS_B_19)
  27 - access("M"."SOURCE_VALUE"="S"."WKP_ID_CEGEDIM" :SYS_B_23 S."ADR_ID_CEGEDIM" :SYS_B_24 S."ADDRESSTYP_COD" AND
              "M"."VPD_COUNTRY"="S"."CTL_COUNTRY")
  29 - filter(COALESCE("S"."END_VAL_DAT",TO_DATE(:SYS_B_25,:SYS_B_26))>=SYSDATE@!)
  30 - access("M"."KEY_TYPE"=:SYS_B_22 AND "M"."VPD_COUNTRY"=:SYS_B_27)
SQL_ID  862aq599gfd6n, child number 0
insert into okc_compare_results (                datetime               
,compare_tables_id               ,compare_target               
,record_count               ,groupby             )                
select sysdate          ,:"SYS_B_00"          ,:"SYS_B_01"          
,count (:"SYS_B_02")          ,:"SYS_B_03" groupby    from   ( (select
:"SYS_B_04" compare_type                    ,t.id_org_addr id_org_addr
-- ID_ORG_ADDR                    ,t.vpd_country vpd_country --
CTL_COUNTRY                    ,t.addr_type addr_type -- ADDRESSTYP_COD
             from   (select *                      from   (select t.*   
                           from      ods.ods_org_addr t                 
                    left outer join                                     
   m_sy_foreign_key m                                     on
m.vpd_country = t.vpd_country ;                                    and
m.key_type = :"SYS_B_05"                                     and
m.target_value = t.id_org_addr
Plan hash value: 3531428851
Id   Operation                                   Name                       Rows   Bytes Cost (%CPU) Time      Pstart Pstop
0 INSERT STATEMENT                                                                          1646 (100)                           
1   LOAD TABLE CONVENTIONAL                                                                                                       
2    SORT AGGREGATE                                                        1                                                
3     VIEW                                                                 1           1646   (1) 00:00:20                
4      MINUS                                                                                                                      
5       SORT UNIQUE                                                        1 163                                        
6        NESTED LOOPS OUTER                                                1 163   1067   (1) 00:00:13                
7         NESTED LOOPS                                                     1 135    599   (1) 00:00:08                
*  8          HASH JOIN                                                       19 1919    577   (2) 00:00:07                
9           PARTITION LIST SINGLE                                          1535 69075    107   (4) 00:00:02    KEY    KEY
* 10            TABLE ACCESS FULL                 OKC_MDL_WORKPLACE_ADDRESS 1535 69075    107   (4) 00:00:02    KEY    KEY
* 11           INDEX RANGE SCAN                   PK_M_SY_FOREIGN_KEY        49537   2709K    469   (1) 00:00:06                
* 12          TABLE ACCESS BY GLOBAL INDEX ROWID ODS_ORG_ADDR               1 34      2   (0) 00:00:01 ROWID ROWID
* 13           INDEX UNIQUE SCAN                  UK_ODS_ORG_ADDR            25              1   (0) 00:00:01                
* 14         INDEX RANGE SCAN                     PK_M_SY_FOREIGN_KEY        1 28    468   (1) 00:00:06                
15       NESTED LOOPS                                                                                                              
16        NESTED LOOPS                                                      1 67      8   (0) 00:00:01                
17         NESTED LOOPS                                                     1 48      7   (0) 00:00:01                
18          NESTED LOOPS                                                    1 23      5   (0) 00:00:01                
* 19           TABLE ACCESS BY GLOBAL INDEX ROWID ODS_COUNTRY_SYSTEM         1 11      2   (0) 00:00:01 ROWID ROWID
* 20            INDEX RANGE SCAN                  PK_ODS_DIVISION_SYSTEM     1              1   (0) 00:00:01                
* 21           TABLE ACCESS FULL                  SY_SOURCE_CODE             1 12      3   (0) 00:00:01                
22          TABLE ACCESS BY INDEX ROWID         SY_FOREIGN_CODE            1 25      2   (0) 00:00:01                
* 23           INDEX RANGE SCAN                   PK_SY_FOREIGN_CODE         1              1   (0) 00:00:01                
* 24         INDEX UNIQUE SCAN                    PK_SY_TARGET_CODE          1              0   (0)                           
* 25        TABLE ACCESS BY INDEX ROWID           SY_TARGET_CODE             1 19      1   (0) 00:00:01                
26       SORT UNIQUE                                                        1535    151K                                        
* 27        HASH JOIN OUTER                                                   1535    151K    577   (2) 00:00:07                
28         PARTITION LIST SINGLE                                            1535 69075    107   (4) 00:00:02    KEY    KEY
* 29          TABLE ACCESS FULL                   OKC_MDL_WORKPLACE_ADDRESS 1535 69075    107   (4) 00:00:02    KEY    KEY
* 30         INDEX RANGE SCAN                     PK_M_SY_FOREIGN_KEY        49537   2709K    469   (1) 00:00:06                
Predicate Information (identified by operation id):
   8 - access("M"."SOURCE_VALUE"="S"."WKP_ID_CEGEDIM" :SYS_B_12 S."ADR_ID_CEGEDIM" :SYS_B_13 S."ADDRESSTYP_COD" AND
              "M"."VPD_COUNTRY"="S"."CTL_COUNTRY")
  10 - filter(COALESCE("S"."END_VAL_DAT",TO_DATE(:SYS_B_14,:SYS_B_15))>=SYSDATE@!)
  11 - access("M"."KEY_TYPE"=:SYS_B_11 AND "M"."VPD_COUNTRY"=:SYS_B_16)
  12 - filter((COALESCE("T"."END_DATE",TO_DATE(:SYS_B_06,:SYS_B_07))>=SYSDATE@! AND "T"."VPD_COUNTRY"=:SYS_B_08))
  13 - access("T"."ID_ORG_ADDR"="M"."TARGET_VALUE")
  14 - access("M"."KEY_TYPE"=:SYS_B_05 AND "M"."VPD_COUNTRY"=:SYS_B_08 AND "M"."TARGET_VALUE"="T"."ID_ORG_ADDR")
       filter("M"."TARGET_VALUE"="T"."ID_ORG_ADDR")
  19 - filter("CS"."SYSTEM_TYPE"=1)
  20 - access("CS"."VPD_COUNTRY"=:B1 AND "CS"."EXP_IMP_TYPE"='I')
       filter("CS"."EXP_IMP_TYPE"='I')
  21 - filter(("SK"."CODE_TYPE"=:SYS_B_18 AND "CS"."ID_SYSTEM"="SK"."ID_SOURCE_SYSTEM"))
  23 - access("FK"."ID_SOURCE_CODE"="SK"."ID_SOURCE_CODE" AND "FK"."SOURCE_VALUE"=UPPER(:B1) AND
              "CS"."VPD_COUNTRY"="FK"."VPD_COUNTRY")
       filter(("FK"."VPD_COUNTRY"=:B1 AND "FK"."SOURCE_VALUE"=UPPER(:B2) AND "CS"."VPD_COUNTRY"="FK"."VPD_COUNTRY"))
  24 - access("FK"."ID_TARGET_CODE"="TK"."ID_TARGET_CODE")
  25 - filter("TK"."CODE_TYPE"=:SYS_B_19)
  27 - access("M"."SOURCE_VALUE"="S"."WKP_ID_CEGEDIM" :SYS_B_23 S."ADR_ID_CEGEDIM" :SYS_B_24 S."ADDRESSTYP_COD" AND
              "M"."VPD_COUNTRY"="S"."CTL_COUNTRY")
  29 - filter(COALESCE("S"."END_VAL_DAT",TO_DATE(:SYS_B_25,:SYS_B_26))>=SYSDATE@!)
  30 - access("M"."KEY_TYPE"=:SYS_B_22 AND "M"."VPD_COUNTRY"=:SYS_B_27)Edited by: BluShadow on 20-Jun-2012 10:30
added {noformat}{noformat} tags for readability.  Please read {message:id=9360002} and learn to do this yourself.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              

yes, all the used tables are analyzed.
Thanks, for pointing to the metalink bug, I have also searched in metalink, but didn't find this bug.
I have a little bit more information about the problem.
I use the following select (now in a readable format)
select count (1)
from   ( (select 'different (target)' compare_type
                ,t.id_org_addr id_org_addr -- ID_ORG_ADDR
                ,t.vpd_country vpd_country -- CTL_COUNTRY
                ,t.addr_type addr_type -- ADDRESSTYP_COD
          from   (select *
                  from   (select t.*
                          from      ods.ods_org_addr t
                                 left outer join
                                    m_sy_foreign_key m
                                 on m.vpd_country = t.vpd_country
                                 and m.key_type = 'ORGADDR2'
                                 and m.target_value = t.id_org_addr
                          where  coalesce (t.end_date, to_date ('99991231', 'yyyymmdd')) >= sysdate) /*SGRB*/
                  where  vpd_country = 'NL' /*EGRB*/
                                           ) t
          where  exists
                    (select null
                     from   (select *
                             from   (select m.target_value id_org_addr
                                           ,s.wkp_id_cegedim || '-' || s.adr_id_cegedim || '-' || s.addresstyp_cod id_cegedim
                                           ,s.*
                                     from      okc_mdl_workplace_address s
                                            left outer join
                                               m_sy_foreign_key m
                                            on m.vpd_country = s.ctl_country
                                            and m.key_type = 'ORGADDR2'
                                            and m.source_value = s.wkp_id_cegedim || '-' || s.adr_id_cegedim || '-' || s.addresstyp_cod
                                     where  coalesce (s.end_val_dat, to_date ('99991231', 'yyyymmdd')) >= sysdate) /*SGRB*/
                             where  ctl_country = 'NL' /*EGRB*/
                                                      ) s
                     where  t.id_org_addr = s.id_org_addr)
          minus
          select 'different (target)' compare_type
                ,s.id_org_addr id_org_addr -- ID_ORG_ADDR
                ,s.ctl_country vpd_country -- CTL_COUNTRY
                , (select to_number (l.target_value)
                   from   okc_code_foreign l
                   where  l.source_code_type = 'TYS'
                   and    l.target_code_type = 'ADDRLINKTYPE'
                   and    l.source_value = upper (s.addresstyp_cod)
                   and    l.vpd_country = s.ctl_country)
                    addr_type -- ADDRESSTYP_COD
          from   (select *
                  from   (select m.target_value id_org_addr
                                ,s.wkp_id_cegedim || '-' || s.adr_id_cegedim || '-' || s.addresstyp_cod id_cegedim
                                ,s.*
                          from      okc_mdl_workplace_address s
                                 left outer join
                                    m_sy_foreign_key m
                                 on m.vpd_country = s.ctl_country
                                 and m.key_type = 'ORGADDR2'
                                 and m.source_value = s.wkp_id_cegedim || '-' || s.adr_id_cegedim || '-' || s.addresstyp_cod
                          where  coalesce (s.end_val_dat, to_date ('99991231', 'yyyymmdd')) >= sysdate) /*SGRB*/
                  where  ctl_country = 'NL' /*EGRB*/
                                           ) s)) The select is executed in 813 msecs
When I execute the same select using execute immediate like:
declare
   ln_count number;
begin
   execute immediate q'[<select statement>]' into ln_count;
end;This takes 3:56 minutes to complete.
When I change the second coalesce part (the one within the exists) in the flowing way:
the part
coalesce (s.end_val_dat, to_date ('99991231', 'yyyymmdd')) >= sysdate
is replaced by
s.end_val_dat >= sysdate or s.end_val_dat is nullthen the execution time is even faster (560 msecs) in both, the plain select and the select using the execute immediate.

Similar Messages

  • Performance issues when creating a Report / Query in Discoverer

    Hi forum,
    Hope you are can help, it involves a performance issues when creating a Report / Query.
    I have a Discoverer Report that currently takes less than 5 seconds to run. After I add a condition to bring back Batch Status that = ‘Posted’ we cancelled the query after reaching 20 minutes as this is way too long. If I remove the condition the query time goes back to less than 5 seconds.
    Please see attached the SQL Inspector Plan:
    Before Condition
    SELECT STATEMENT
    SORT GROUP BY
    VIEW SYS
    SORT GROUP BY
    NESTED LOOPS OUTER
    NESTED LOOPS OUTER
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS OUTER
    NESTED LOOPS OUTER
    NESTED LOOPS
    NESTED LOOPS OUTER
    NESTED LOOPS OUTER
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    TABLE ACCESS BY INDEX ROWID GL.GL_CODE_COMBINATIONS
    AND-EQUAL
    INDEX RANGE SCAN GL.GL_CODE_COMBINATIONS_N2
    INDEX RANGE SCAN GL.GL_CODE_COMBINATIONS_N1
    TABLE ACCESS BY INDEX ROWID APPLSYS.FND_FLEX_VALUES
    INDEX RANGE SCAN APPLSYS.FND_FLEX_VALUES_N1
    TABLE ACCESS BY INDEX ROWID APPLSYS.FND_FLEX_VALUE_SETS
    INDEX UNIQUE SCAN APPLSYS.FND_FLEX_VALUE_SETS_U1
    TABLE ACCESS BY INDEX ROWID APPLSYS.FND_FLEX_VALUES_TL
    INDEX UNIQUE SCAN APPLSYS.FND_FLEX_VALUES_TL_U1
    INDEX RANGE SCAN APPLSYS.FND_FLEX_VALUE_NORM_HIER_U1
    TABLE ACCESS BY INDEX ROWID GL.GL_JE_LINES
    INDEX RANGE SCAN GL.GL_JE_LINES_N1
    INDEX UNIQUE SCAN GL.GL_JE_HEADERS_U1
    INDEX UNIQUE SCAN GL.GL_SETS_OF_BOOKS_U2
    TABLE ACCESS BY INDEX ROWID GL.GL_JE_HEADERS
    INDEX UNIQUE SCAN GL.GL_JE_HEADERS_U1
    INDEX UNIQUE SCAN GL.GL_DAILY_CONVERSION_TYPES_U1
    TABLE ACCESS BY INDEX ROWID GL.GL_JE_SOURCES_TL
    INDEX UNIQUE SCAN GL.GL_JE_SOURCES_TL_U1
    INDEX UNIQUE SCAN GL.GL_JE_CATEGORIES_TL_U1
    INDEX UNIQUE SCAN GL.GL_JE_HEADERS_U1
    INDEX UNIQUE SCAN GL.GL_JE_HEADERS_U1
    INDEX UNIQUE SCAN GL.GL_JE_BATCHES_U1
    INDEX UNIQUE SCAN GL.GL_BUDGET_VERSIONS_U1
    INDEX UNIQUE SCAN GL.GL_ENCUMBRANCE_TYPES_U1
    INDEX UNIQUE SCAN GL.GL_SETS_OF_BOOKS_U2
    TABLE ACCESS BY INDEX ROWID GL.GL_JE_BATCHES
    INDEX UNIQUE SCAN GL.GL_JE_BATCHES_U1
    INDEX UNIQUE SCAN GL.GL_SETS_OF_BOOKS_U2
    INDEX UNIQUE SCAN GL.GL_JE_BATCHES_U1
    TABLE ACCESS BY INDEX ROWID GL.GL_PERIODS
    INDEX RANGE SCAN GL.GL_PERIODS_U1
    After Condition
    SELECT STATEMENT
    SORT GROUP BY
    VIEW SYS
    SORT GROUP BY
    NESTED LOOPS
    NESTED LOOPS OUTER
    NESTED LOOPS OUTER
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS OUTER
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS OUTER
    NESTED LOOPS
    NESTED LOOPS OUTER
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS OUTER
    NESTED LOOPS
    TABLE ACCESS FULL GL.GL_JE_BATCHES
    INDEX UNIQUE SCAN GL.GL_SETS_OF_BOOKS_U2
    INDEX UNIQUE SCAN GL.GL_JE_BATCHES_U1
    TABLE ACCESS BY INDEX ROWID GL.GL_JE_HEADERS
    INDEX RANGE SCAN GL.GL_JE_HEADERS_N1
    INDEX UNIQUE SCAN GL.GL_SETS_OF_BOOKS_U2
    INDEX UNIQUE SCAN GL.GL_ENCUMBRANCE_TYPES_U1
    INDEX UNIQUE SCAN GL.GL_DAILY_CONVERSION_TYPES_U1
    INDEX UNIQUE SCAN GL.GL_BUDGET_VERSIONS_U1
    TABLE ACCESS BY INDEX ROWID GL.GL_JE_SOURCES_TL
    INDEX UNIQUE SCAN GL.GL_JE_SOURCES_TL_U1
    INDEX UNIQUE SCAN GL.GL_JE_CATEGORIES_TL_U1
    INDEX UNIQUE SCAN GL.GL_JE_BATCHES_U1
    TABLE ACCESS BY INDEX ROWID GL.GL_JE_LINES
    INDEX RANGE SCAN GL.GL_JE_LINES_U1
    INDEX UNIQUE SCAN GL.GL_SETS_OF_BOOKS_U2
    TABLE ACCESS BY INDEX ROWID GL.GL_CODE_COMBINATIONS
    INDEX UNIQUE SCAN GL.GL_CODE_COMBINATIONS_U1
    TABLE ACCESS BY INDEX ROWID GL.GL_PERIODS
    INDEX RANGE SCAN GL.GL_PERIODS_U1
    TABLE ACCESS BY INDEX ROWID APPLSYS.FND_FLEX_VALUES
    INDEX RANGE SCAN APPLSYS.FND_FLEX_VALUES_N1
    INDEX RANGE SCAN APPLSYS.FND_FLEX_VALUE_NORM_HIER_U1
    TABLE ACCESS BY INDEX ROWID APPLSYS.FND_FLEX_VALUES_TL
    INDEX UNIQUE SCAN APPLSYS.FND_FLEX_VALUES_TL_U1
    TABLE ACCESS BY INDEX ROWID APPLSYS.FND_FLEX_VALUE_SETS
    INDEX UNIQUE SCAN APPLSYS.FND_FLEX_VALUE_SETS_U1
    INDEX UNIQUE SCAN GL.GL_JE_HEADERS_U1
    INDEX UNIQUE SCAN GL.GL_JE_HEADERS_U1
    INDEX UNIQUE SCAN GL.GL_JE_HEADERS_U1
    Is there anything i can do in Discoverer Desktop / Administration to avoid this problem.
    Many thanks,
    Lance

    Hi Rod,
    I've tried the condition (Batch Status||'' = 'Posted') as you suggested, but the qeury time is still over 20 mins. To test i changed it to (Batch Status||'' = 'Unposted') and the query was returned within seconds again.
    I’ve been doing some more digging and have found the database view that is linked to the Journal Batches folder. See below.
    I think the problem is with the column using DECODE. When querying the column in TOAD the value of ‘P’ is returned. But in discoverer the condition is done on the value ‘Posted’. I’m not too sure how DECODE works, but think this could be the causing some sort of issue with Full Table Scans. How do we get around this?
    Lance
    DECODE( JOURNAL_BATCH1.STATUS,
    '+', 'Unable to validate or create CTA',
    '+*', 'Was unable to validate or create CTA',
    '-','Invalid or inactive rounding differences account in journal entry',
    '-*', 'Modified invalid or inactive rounding differences account in journal entry',
    '<', 'Showing sequence assignment failure',
    '<*', 'Was showing sequence assignment failure',
    '>', 'Showing cutoff rule violation',
    '>*', 'Was showing cutoff rule violation',
    'A', 'Journal batch failed funds reservation',
    'A*', 'Journal batch previously failed funds reservation',
    'AU', 'Showing batch with unopened period',
    'B', 'Showing batch control total violation',
    'B*', 'Was showing batch control total violation',
    'BF', 'Showing batch with frozen or inactive budget',
    'BU', 'Showing batch with unopened budget year',
    'C', 'Showing unopened reporting period',
    'C*', 'Was showing unopened reporting period',
    'D', 'Selected for posting to an unopened period',
    'D*', 'Was selected for posting to an unopened period',
    'E', 'Showing no journal entries for this batch',
    'E*', 'Was showing no journal entries for this batch',
    'EU', 'Showing batch with unopened encumbrance year',
    'F', 'Showing unopened reporting encumbrance year',
    'F*', 'Was showing unopened reporting encumbrance year',
    'G', 'Showing journal entry with invalid or inactive suspense account',
    'G*', 'Was showing journal entry with invalid or inactive suspense account',
    'H', 'Showing encumbrance journal entry with invalid or inactive reserve account',
    'H*', 'Was showing encumbrance journal entry with invalid or inactive reserve account',
    'I', 'In the process of being posted',
    'J', 'Showing journal control total violation',
    'J*', 'Was showing journal control total violation',
    'K', 'Showing unbalanced intercompany journal entry',
    'K*', 'Was showing unbalanced intercompany journal entry',
    'L', 'Showing unbalanced journal entry by account category',
    'L*', 'Was showing unbalanced journal entry by account category',
    'M', 'Showing multiple problems preventing posting of batch',
    'M*', 'Was showing multiple problems preventing posting of batch',
    'N', 'Journal produced error during intercompany balance processing',
    'N*', 'Journal produced error during intercompany balance processing',
    'O', 'Unable to convert amounts into reporting currency',
    'O*', 'Was unable to convert amounts into reporting currency',
    'P', 'Posted',
    'Q', 'Showing untaxed journal entry',
    'Q*', 'Was showing untaxed journal entry',
    'R', 'Showing unbalanced encumbrance entry without reserve account',
    'R*', 'Was showing unbalanced encumbrance entry without reserve account',
    'S', 'Already selected for posting',
    'T', 'Showing invalid period and conversion information for this batch',
    'T*', 'Was showing invalid period and conversion information for this batch',
    'U', 'Unposted',
    'V', 'Journal batch is unapproved',
    'V*', 'Journal batch was unapproved',
    'W', 'Showing an encumbrance journal entry with no encumbrance type',
    'W*', 'Was showing an encumbrance journal entry with no encumbrance type',
    'X', 'Showing an unbalanced journal entry but suspense not allowed',
    'X*', 'Was showing an unbalanced journal entry but suspense not allowed',
    'Z', 'Showing invalid journal entry lines or no journal entry lines',
    'Z*', 'Was showing invalid journal entry lines or no journal entry lines', NULL ),

  • Creating multiple tab reports using the same query in Web intelligence

    Hi All,
    I have created a Universe on a BW Query which has fields as below
    AGE  Depaatment  Gender  Grade
    25       FIN                M            A
    27       LES               F            A+
    60       SWS            M             A++
    Based on this data i have created a WEbi report which shows all of these data under one tab.
    Now i create a new report tab in the same Webi Document by right cliicking the existing report and going to inset report and saving it.
    Similarly i create two more new report tabs.
    in each of these tabs i want to show data only for the concened departments.ie =1st report contains all the departments.
    2nd report contains only finance data, third contains only Les data  and fourth only SWs Data.
    Is it possible to create this report using the same query?
    Regards,
    Raj.

    You should use report filters, not query filters.
    A query filter will affect the entire document. Every report tab that pulls data from that query will be impacted. If you start with a single report, by default it shows the data from the query. If you duplicate that report tab, then it's still attached to the first query. There are various ways to create report filters (input controls, quick filter, invoking the filter area from the toolbar) and a report filter impacts only blocks on that report tab. You can even create block filters by clicking on the block first, then creating your filter.
    This is a fairly confusing bit for folks that are new to Web Intelligence.

  • How can i use the same id on two different laptops?

    When trying to use the same login on two different laptops so that i can connect my nook to either depending on which one is free, i get the error that the id is already in use on another computer?

    The issue is embedded in the way the software works.  To comply with the
    Digital Millenium Copyright Act of 2000, all software companies in this
    business keep track of where their software is installed, making
    information about the computer and ereaders part of an ID file.  So, your
    user ID is embedded in the ID file of each computer, but each computer has
    a different ID of its own that is also embedded in that file.  Adobe's
    master server (yes, there is one that you connect to even if you didn't
    know it) also has that information, and when you try to use an ID on one
    that's embedded in the file of another, Adobe's server blows the whistle,
    and as you can see, you can't do that....
    ==========

  • How to use the same OC4j server with different port number

    How to use the same OC4j server with different port numbers..?
    I have to OC4J installed on my machine on different hard disk drives....
    I want to be able to run both the server simultaneously..?
    is it possible ..it yes then how..?
    for that i have changed the port number of one server...
    but when i am trying to start the other server with different port number..it says that JVM -Bind already...
    Is there any clues...?
    Nilesh G

    In the config directory:
    default-web-site.xml: Change the port the HTTP listener listens on
    jms.xml: Change the port the JMS service listens on
    rmi.xml: Change the port the ORMI listener listens on.
    Or, you can add another web-site.xml file, and deploy your applications to 1 server, and bind the web applications to the different web sites. This way you only have to deploy your applications to 1 place.
    Rob
    Oracle

  • Is it possible to use the same Switch for two different clusters.

    I have 10g Rac setup on windows.
    Now I am planning to install 11gR2 on different servers.
    Is it possible to use the same Switch for two different clusters.

    user9198027 wrote:
    I have 10g Rac setup on windows.
    Now I am planning to install 11gR2 on different servers.
    Is it possible to use the same Switch for two different clusters.
    Yes.  Technically there will not be any conflict as long as the private addresses used by the 2 clusters do not collide, and provided that the switch's port capacity and bandwidth will not be exceeded.
    Your NA (netadmin) can also configure the switch to separate the 2 Interconnects from one another (called partitioning when using Infiniband) - if the switch supports such features.
    A major consideration is not to make the switch, public. That typically cause a range of problems and can have a serious impact on an Interconnect. But using 2 private networks on the same infrastructure should not have the same problems - if configured and implemented correctly.

  • 2 iphones 1 computer. updated my wifes phone to ios 5 her phone got wiped of all apps and all my contacts are on her phone. we had been using the same apple id but different user accounts on our laptop. How do i get her phone back to normal?

    2 iphone 4, 1 computer. i upgraded to ios 5 and just updated my wifes phone as well. her phone got wiped of all apps and all my contacts were put on her phone. we had been using the same apple id but different user acct on our laptop. How do i get her phone back to normal??

    Have your wife log in to her user account on the laptop. Launch iTunes, then connect her phone to the computer with the USB cable. Sync. That should put back all apps and media. Since you already upgraded her to iOS 5 she'll have to manually enter all her settings and preferences, and organize her home screens.

  • Can i use the same email address for different users?

    we are a small department with one email address, can i use the same email address for different users?

    No. Each user needs to have his unique ID.
    Mylenium

  • Add Multiple Detail Items Using the Same Query String Parameter

    I am using InfoPath 2010 and SharePoint 2010. 
    I have 2 forms libraries - Expense and Expense Details. 
    The 2 libraries are linked via a custom site column Expense ID. 
    The Expense form contains the main header type info you would typically find on an expense report; e.g., name, purpose, department, etc. 
    The Expense Details form contains multiple detail expenses related to the main expense report such as airfare, rental car, etc. 
    I have created a page that displays an expense report with all of the related expense detail items. 
    The page contains a link to add a new expense detail and passes the Expense ID of the Expense form to the Expense Detail form. 
    This all works fine.  The problem comes in after the first expense detail form is submitted. 
    I can successfully submit the first detail item.  However, the expense detail form loses the Expense ID that was passed to it after the first expense detail form has been submitted. 
    The parameter still shows in the URL but the detail form no longer shows the value of the parameter. 
    What do I need to do in order to be able to add multiple expense detail items using the same Expense ID that was passed to the form? 
    I have tried using a Submit Behavior of Open a new form, Close the form, and Leave the form open. 
    None of these options give me what I need.  Thanks for your help.
    pam

    Laura Rogers Blog
    In case anyone stumbles upon this looking for an answer. Laura Rogers has the answer found in the comments section of her blog above.  It’s not the best but it
    does work. You have to add an extra Info Path Web Form for it to work. I know, you can roll your eyes.<o:p></o:p>
    Steps.<o:p></o:p>
    1. Add Query String<o:p></o:p>
    2. Add the extra Info Path form to the page. This form will be a hidden on the page and will receive the value from the query string.<o:p></o:p>
    3. Add your original Info Path form and have it receive a parameter from the hidden Info Path form.<o:p></o:p>
    Now, when you hit save and it opens a new form the 3 Info Path form will function properly. <o:p></o:p>

  • Can you share apps between accounts when using the same PC

    My wife and I have always shared my account. made it easy to purchase and share. Howeever, with iCloud etc its becoming increasingly obvious that seperate accounts might be needed.
    Can you share apps you purchase through differnt accounts when your using the same computer?
    I now you can with music.

    Yes.
    If you want the other user to be able to see the pics, but not add to, change or alter your library, then enable Sharing in your iPhoto (Preferences -> Sharing), leave iPhoto running and use Fast User Switching to open the other account. In that account, enable 'Look For Shared Libraries'. Your Library will appear in the other source pane.
    Any user can drag a pic from the Shared Library to their own in the iPhoto Window.
    Remember iPhoto must be running in both accounts for this to work.
    You can figure out using it with another machine from that too

  • Why have I been charged again for downloading the djay app whenI used the same sign in but on a different computer?

    I bought dajay app on one of my Macs and thoght that if I signed in with the same ID, I woudl not be charged again. ut I was.
    The one I downloaded is the newer version. Couldn't find the old version!
    Ideas?

    Hi...
    Try the app developer's support page >  http://www.algoriddim.com/support/djay-mac
    There's an email address available at the bottom of the page on that link.
    You should be able to re download apps on all your authorized Macs using the same Apple ID for free.
    You can report the issue to Apple here > Apple - Support - Mac App Store - Contact Support

  • Can you use the same Apple Id on different devices.

    Can I use the same Apple ID on two different iPads? My kids just got school issued iPads and they need to have an Apple ID. They have iPhones with there own Apple ID's. We use one Apple ID for purchases for our family. Can they use there current Apple ID with the iPads without the purchase Apple Id being associated. Will they be able to load music and apps that were purchased with the family Apple Id?

    I am just a little confused about the way that you asked thes questions. But here is my take.
    1. Yes - You can use two Apple ID's on an iPad.
    2. You can use the same Apple ID on up to 10 total devices - but there is a five computer limit in that total of 10 devices.
    3. If you use one ID for some things and then use the family ID to download past purchases for free - you will lock themselves out of the other ID for 90 days.
    4. When you download a past purchase on an iDevice using a different ID - you associate that device with that ID and you are locked into that ID only for 90 days.

  • Mozilla using the same session ID for  different browser

    Hi
    I am using mozilla to test my application. I tested two subscription of my application in two different mozilla browsers simultaneously.
    Here I Found details are swapped. Because mozilla using the same JSession ID for the two browser.
    This is a flaw in mozilla or whether this issue is solved in any one of the version of mozilla.
    When ever I am opening a new window, new session ID should be created like in IE (Internet explorer).this not happening in Mozilla.
    Can any one help me out from this problem?
    Thanks
    Dilip

    Hi,
    I cannot help you with your problem.
    But I want to ask what are you using to control Firefox ( on Windows... ) ?
    Thanks

  • How to create more than one VIP use the same IP address and different port(e.g. 80 and 443)

    Hi,
    I use SCVMM LB Provider deploy network. I want to create 2 VIP use the same virtual IP but use the different port.
    for example:   VIP address 1.1.1.123   use port 80 for HTTP   and port 443 for HTTPS
    However,
    the following problems encountered, when I create the second VIP.
    PS C:\Windows\system32> New-SCLoadBalancerVIP -Name "vip11" -LoadBalancer $LB -IPAddress "1.1.1.123" -LoadBalancerVIPTemplate $VIPTemplate1 -LoadBalancerProtocol $Protocol1 -LoadBalancerHealthMonitor $HM1
    New-SCLoadBalancerVIP : A virtual IP (VIP) address with the specified name (vip11) or
    address (1.1.1.123) already exists on the load balancer (xxx). (Error ID: 13691)
    Specify a different name or IP address and try again.
    To restart the job, run the following command:
    PS> Restart-Job -Job (Get-VMMServer localhost | Get-Job | where { $_.ID -eq
    "{b41a77eb-ae0b-490a-8948-662a529b1d8c}"})
    At line:1 char:1
    + New-SCLoadBalancerVIP -Name "vip11" -LoadBalancer $LB -IPAddress "1.1.1.123" -Lo ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ReadError: (:) [New-SCLoadBalancerVIP], CarmineException
        + FullyQualifiedErrorId : 13691,Microsoft.SystemCenter.VirtualMachineManager.Cmdlets.Ne
       wSCLoadBalancerVIPCmdlet
    PS C:\Windows\system32>
    any suggestions ?
    Thank you in advance !

    I really don't know DDE very well. It is usually recommended that you switch to using ActiveX. You may not be correctly configuring the netDDE server. There is an example in the reource library that shows how to do this. You may also want to look at the DDE advise examples that came with LabVIEW 5.1 and earlier.

  • HT204053 Can my children and I use the same apple ID with different iPhone iPad and iPod ?

    I am having trouble with my new iPhone 5 address book and some updates on the apps store
    There's some old apple ID that is showing up. I don't even remember this email address
    What can I do to adjust all this
    Thanks

    You can certainly use the same ID for an itunes store account to share purchased items.  However for icloud, it's designed so that each account pertains to one user for each of his/her devices.  The main purpose of icloud is syncing and backups of iOS devices.  Do you really want to have the same email account, same contacts, calendars, notes, reminders, etc?  Usually a couple needs to have separate icloud accounts.  They can share calenders if they want.
    The danger of two users using one account is if one user edits or deletes (on purpose or accidentally) data, that will propagate to the other user's devices.

Maybe you are looking for

  • How do i add the airplay icon to the toolbar?

    I upgraded to Mountain Lion.  But, when I am on Safari, the AirPlay icon is missing.  How can I add it?  Thank you. Peace.

  • Add a jar file to Java load path at run time

    Hi I loaded my file successfully , but when I tried to use the driver to connect to the DB , I get java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver Here is my class import java.net.URL; import java.io.IOException; import java.net.URLClassL

  • Characteristic as InfoProvider and Key in ODS?

    Hi, Can I use a Characteristic as both InfoProvider and as KeyField in ODS? If I have to use it as InfoProvider I need to turn on "Character is InfoProvider" in Master Data/Texts tabstrip. So will setting this option to effect my using of same charac

  • Limiting Bandwidth on a 6509 switchport.

    We have a user that is gaming, is there a way to rate limit bandwidt to the switchport that is workstation is conncected. interface FastEthernet7/5 description D40A no ip address switchport switchport access vlan 74 switchport mode access spanning-tr

  • How to learn XI

    Hi all, Iam a BW consultant and totally new to SAP XI. I want to know about XI. Can you please refer me some links, Pdfs, and any books where could I grow up in XI? Thanks.