How to use index, when query has decode/case

Hi,
I have the following query
i have a index on party_id,party_type_Code in the zx_party_tax_profile table But this index is not used as Iam using a decode on the columns of the zx_party_tax_profile table,
Is there any way i can rewrite the query so that it uses index
sELECT /*+ INDEX(ZX_PARTY_TAX_PROFILE_U2) */ party_tax_profile_id FROM (SELECT
ThirdPartyTaxProfileEO.SUPPLIER_FLAG,
ThirdPartyTaxProfileEO.CUSTOMER_FLAG,
ThirdPartyTaxProfileEO.SITE_FLAG,
ThirdPartyTaxProfileEO.PARTY_TAX_PROFILE_ID,
ThirdPartyTaxProfileEO.PARTY_ID,
ThirdPartyTaxProfileEO.REP_REGISTRATION_NUMBER,
ThirdPartyTaxProfileEO.OBJECT_VERSION_NUMBER,
ThirdPartyTaxProfileEO.REGISTRATION_TYPE_CODE,
ThirdPartyTaxProfileEO.COUNTRY_CODE,
ThirdPartyTaxProfileEO.MERGED_TO_PTP_ID,
ThirdPartyTaxProfileEO.MERGED_STATUS_CODE,
ThirdPartyTaxProfileEO.PROGRAM_APP_NAME,
ThirdPartyTaxProfileEO.PROGRAM_NAME,
PartyPEO.PARTY_NAME,
PartyPEO.PARTY_ID AS PARTY_ID1,
PartyPEO.PARTY_NUMBER,
decode(ThirdPartyTaxProfileEO.CUSTOMER_FLAG,
'Y',decode(ThirdPartyTaxProfileEO.SUPPLIER_FLAG,
'Y', 'SC',
'C'),
decode(ThirdPartyTaxProfileEO.SUPPLIER_FLAG,
'Y', 'S',
NULL)
) AS PARTY_USAGE,
ThirdPartyTaxProfileEO.REP_REGISTRATION_NUMBER AS TAX_REG_NUMBER,
LkupPartyUsage.MEANING AS PARTY_USAGE_DESC,
PartyPEO.PARTY_NAME AS PARTY_FULL_NAME,
PartyPEO.ADDRESS1||','||
PartyPEO.ADDRESS2||','||
PartyPEO.ADDRESS3||','||
PartyPEO.CITY||','||
PartyPEO.postal_code||','||
PartyPEO.COUNTRY AS ADDRESS,
PartyPEO.COUNTRY AS COUNTRY_CODE_TCA,
TerritoryPEO.TERRITORY_SHORT_NAME AS COUNTRY_NAME,
PartyPEO.JGZZ_FISCAL_CODE AS TAX_PAYER_ID,
PartyPEO.DUNS_NUMBER_C AS DUNS_NUMBER,
PartyPEO.Party_Number as Party_Num_Calc,
null as REGISTRATION_TYPE_NAME,
null as ROUNDING_LEVEL_NAME,
null as ROUNDING_RULE_NAME,
null as COUNTRY_NAME_PTP,
'ZX_PARTY_TAX_PROFILE' as TAX_REPORTING_ENTITY_CODE
FROM ZX_PARTY_TAX_PROFILE ThirdPartyTaxProfileEO,
HZ_PARTIES PartyPEO,
FND_LOOKUP_VALUES_VL LkupPartyUsage,
FND_TERRITORIES_VL TerritoryPEO
WHERE ThirdPartyTaxProfileEO.PARTY_ID = PartyPEO.PARTY_ID AND
LkupPartyUsage.LOOKUP_CODE = decode(ThirdPartyTaxProfileEO.CUSTOMER_FLAG,
'Y',decode(ThirdPartyTaxProfileEO.SUPPLIER_FLAG,
'Y', 'SC',
'C'),
decode(ThirdPartyTaxProfileEO.SUPPLIER_FLAG,
'Y', 'S',
NULL)
) AND
PartyPEO.COUNTRY = TerritoryPEO.Territory_Code (+) AND
LkupPartyUsage.LOOKUP_TYPE = 'ZX_TP_PARTY_USAGE'
ORDER BY UPPER(PARTY_FULL_NAME)) QRSLT WHERE UPPER(PARTY_NAME) IS NOT
NULL
Any help will be appreciated

You can rewrite your where clause to not use decode or case statements e.g. this:
  AND LkupPartyUsage.LOOKUP_CODE = DECODE( ThirdPartyTaxProfileEO.CUSTOMER_FLAG
                            , 'Y', DECODE( ThirdPartyTaxProfileEO.SUPPLIER_FLAG, 'Y', 'SC', 'C' )
                                 , DECODE( ThirdPartyTaxProfileEO.SUPPLIER_FLAG, 'Y', 'S', NULL ) )
                                 )can be rewritten to this:
and (
      ( ThirdPartyTaxProfileEO.CUSTOMER_FLAG = 'Y'  AND
          ((ThirdPartyTaxProfileEO.SUPPLIER_FLAG = 'Y' AND LkupPartyUsage.LOOKUP_CODE = 'SC') or
            ThirdPartyTaxProfileEO.SUPPLIER_FLAG != 'Y' AND LkupPartyUsage.LOOKUP_CODE = 'C')) or
      ( ThirdPartyTaxProfileEO.CUSTOMER_FLAG != 'Y'  AND
          ((ThirdPartyTaxProfileEO.SUPPLIER_FLAG = 'Y' AND LkupPartyUsage.LOOKUP_CODE = 'S') or
            ThirdPartyTaxProfileEO.SUPPLIER_FLAG != 'Y' AND LkupPartyUsage.LOOKUP_CODE is null))
    )It's not as sussinct, but it avoids the use of functions that could be preventing the optimiser from using an index.

Similar Messages

  • How to use index when use analytic functions?

    Oracle 11gR2, I have a an indexed snapshot log table (sequence$$ and PK indexed), and I use a query to access it...
    query looks like:
    SELECT "M_ROW$$", "SNAPTIME$$", "DMLTYPE$$", "OLD_NEW$$", "CHANGE_VECTOR$$", "SEQUENCE$$", "ID", "SITEID", "WEBPAGEID", "WEBFOLDERID"
    FROM mlog$_table1
    WHERE dmltype$$ = 'D'
    AND sequence$$ IN
    (SELECT DISTINCT
    LAST_VALUE (sequence$$)
    OVER (PARTITION BY siteid ORDER BY siteid)
    FROM mlog$_table1);
    how could I access mlog$_table1
    explain plan looks like:
    Plan
    SELECT STATEMENT ALL_ROWSCost: 53 Bytes: 605.864 Cardinality: 1.736                          
         6 HASH JOIN Cost: 53 Bytes: 605.864 Cardinality: 1.736                     
              4 VIEW VIEW SYS.VW_NSO_1 Cost: 28 Bytes: 22.555 Cardinality: 1.735                
                   3 HASH UNIQUE Cost: 28 Bytes: 45.110 Cardinality: 1.735           
                        2 WINDOW SORT Cost: 28 Bytes: 45.110 Cardinality: 1.735      
                             1 TABLE ACCESS FULL TABLE BONGO.MLOG$_PDSI1 Cost: 25 Bytes: 45.110 Cardinality: 1.735
              5 TABLE ACCESS FULL TABLE BONGO.MLOG$_PDSI1 Cost: 25 Bytes: 582.960 Cardinality: 1.735

    ok, I think I feel like a newbie :)
    explain plan for your query is:
    Plan
    SELECT STATEMENT ALL_ROWSCost: 22,1 Bytes: 416,678 Cardinality: 2,654           
         2 SORT GROUP BY Cost: 22,1 Bytes: 416,678 Cardinality: 2,654      
              1 TABLE ACCESS FULL TABLE IBIS.MLOG$_PARTIJA Cost: 22,098 Bytes: 416,678 Cardinality: 2,654
    but it runs for about 3-4 sec..
    1st query:
    create or replace view x as
    select * from mlog$_partija v
    where not (DMLTYPE$$='D' and update_type=2)
    and sequence$$=(select max(sequence$$) from mlog$_partija t
    where t.par_sifpar=v.par_sifpar);
    runs about 17 sec...
    wich is expected since there's a max in subselect...
    but, it's explain plan is:
    Plan
    SELECT STATEMENT ALL_ROWSCost: 108,957 Bytes: 1,84 Cardinality: 1                     
         5 HASH JOIN Cost: 108,957 Bytes: 1,84 Cardinality: 1                
              3 VIEW VIEW SYS.VW_SQ_1 Cost: 22,564 Bytes: 68.634.228 Cardinality: 2.639.778           
                   2 HASH GROUP BY Cost: 22,564 Bytes: 68.634.228 Cardinality: 2.639.778      
                        1 TABLE ACCESS FULL TABLE IBIS.MLOG$_PARTIJA Cost: 22,05 Bytes: 68.634.228 Cardinality: 2.639.778
              4 TABLE ACCESS FULL TABLE IBIS.MLOG$_PARTIJA Cost: 22,145 Bytes: 4.788.557.292 Cardinality: 2.639.778           
    but, I made a third solution wich is something like:
    create table mlog_table1_last as
    select siteid, max(sequence$$) max_seq from mlog$_table1 group by siteid
    I run a query on that temp table:
    select * from mlog$_table1 v
    where not (DMLTYPE$$='D' and update_type=2)
    and sequence$$=(select max_seq from mlog_table1_last t
    where t.siteid=v.siteid);
    it's explain plan is bad:
    Plan
    SELECT STATEMENT ALL_ROWSCost: 2.588.886 Bytes: 1,814 Cardinality: 1           
         3 FILTER      
              1 TABLE ACCESS FULL TABLE IBIS.MLOG$_PARTIJA Cost: 22,148 Bytes: 4.788.557.292 Cardinality: 2.639.778
              2 INDEX RANGE SCAN INDEX IBIS.MLOG_PARIJA_LAST_NDX2 Cost: 1 Bytes: 111,02 Cardinality: 4,27
    but it runs for 1-2 sec..
    why?

  • How can i see when someone has accessed my call/text log. (This is possible on google) I have been informed that someone has accessed my activity log and is giving my information to a third party. I believe it is a service tech, but I am not interested in

    How can i see when someone has accessed my call/text log. (This is possible on google/gmail) I have been informed that someone has accessed my activity log and is giving my information to a third party. I believe it is a service tech, but I am not interested in persuing that further. I just need to see when my account has been accessed if possible.

    Hi lynniewigs,
    This is a common concern among Android and I-phone user, and one of the drawbacks to using a smart phone.  We lose so much privacy. Our phones become cameras into our homes for us to be spied on.
    I don't know what type of phone you have, if it is even a smart phone, but here is an example of an application that you can use to determine which applications are accessing your information and sending it out. 
    Permission Scanner - Android Apps on Google Play
    Google just recently revamp their permissions geared to hide invasive applications that spy and send out your information without your knowledge.  Report says be aware of what your Android app does - CNET
    Please continue to be mindful of the apps you download and the permissions you give. 

  • How to use WMI to query to distinguish legacy and UEFI mode Windows?

    How to use WMI to query to distinguish legacy and UEFI mode Windows?

    This document covers requirements for UEFI support.
    http://msdn.microsoft.com/en-us/windows/hardware/gg463144.aspx
    One of the requirements seems to be ACPI. The Win32_BIOS class of WMI has a BIOSCharacteristics property that indicates if ACPI is supported. See this link for properties exposed by Win32_BIOS:
    http://msdn.microsoft.com/en-us/library/aa394077(v=VS.85).aspx
    There is a PowerShell example showing how to get this information at the bottom. You will need to study the document in the first link to see what else is required.
    Richard Mueller - MVP Directory Services

  • How to use C:when test... inside column in ADF table

    I am using ADF table with below two columns
    in First column i have to check the Type of document if it is doc type then i have to use commondlink to download that file ,Otherwise i need to show only text.
    for that i added
    *<c:when test="{boolean($favoriteType eq 'doc')}">*
    which is not working .
    please let me know how to use <C:when test... inside column in ADF table
    <tr:column sortProperty="favoriteName" sortable="true"
    headerText="#{res['favorite.favoritename']}"
    width="500" noWrap="false">
    <c:choose>
    *<c:when test="{boolean($favoriteType eq 'doc')}">*
    <tr:commandLink actionListener="#{bindings.downloadFile.execute}"
    text="#{row.favoriteName}"
    disabled="#{!bindings.downloadFile.enabled}"/>
    </c:when>
    <c:otherwise>
    <af:outputText value="#{row.favoriteName}"/>
    </c:otherwise>
    </c:choose>
    </tr:column>
    <tr:column sortProperty="favoriteType" sortable="true"
    headerText="#{res['favorite.favoriteType']}" rendered="true">
    <af:outputText value="#{row.favoriteType}" id="favoriteType"/>
    </tr:column>

    Hi Frank,
    Thanks it is working like cham..
    related to same page i am facing new problem which i posted at below thread
    How to get row data runtime @ trinidad table , set rowSelection="multiple"
    can u reply on same.
    Thanks for all help.
    Jaydeep

  • Regarding how to use index , please give me some example if possible

    Hello everybody:
           Thank you all for your help in  advance .
           would you please tell me how to use index, please give me  some example if possible.  couldn't thank you more!
          best regards .
         Frank

    Index is used for faster access of data base tables.
    An index helps to speed up selection from the database. An index is a sorted copy of selected database table fields.
    The primary index is always automatically created in an ABAP-based SAP system. It consists of the primary key fields of the database table. This means, for each combination of the index fields exists a maximum of one record in the table. This kind of index is called a UNIQUE index.
    If the primary index cannot be used to determine selection result, (for example, the WHERE condition does not contain any primary index fields), the system searches the whole table. To prevent this, and determine the selection result by searching through a restricted number of database records, you can create a secondary index.
    However, you should not define an index for all possible fields in the WHERE condition.
    Check this thread..u have more details.
    In which situation we can use the reading of  index

  • Not using Index when SDO_RELATE in Spatial Query is used in LEFT OUTER JOIN

    I want to know for every City (Point geometry) in which Municipality (Polygon geometry) it is.
    Some cities will not be covered by any municipality (as there is no data for it), so its municipality name should be blank in the result
    We have 4942 cities (point geometries)
    and 500 municipalities (polygon geometry)
    SELECT T1.NAME as City, T2.NAME as Municipality
    FROM CITY T1
    LEFT OUTER JOIN MUNICIPALITY T2 ON SDO_RELATE(T1.GEOM, T2.GEOM, 'MASK=ANYINTERACT') = 'TRUE'The explain plan for this query is:
    SELECT STATEMENT
      FILTER
        Filter Predicates
          MDSYS.SDO_RTREE_RELATE(T1.GEOM, T2.GEOM, 'mask=ANYINTERACT querytype=window ') = 'TRUE'
        MERGE JOIN
          TABLE ACCESS              CITY               FULL                            11
          BUFFER                                       SORT                        100605
              TABLE ACCESS          MUNICIPALITY       FULL                            20So the cost is in the BUFFER (whatever that is), it takes +2000 seconds to run this, it is not using the spatial index.
    And we are not getting all rows, but only the ones interacting with a municipality, e.g. 2436 rows.
    But I want all rows, including the ones not interacting with any Municipality.
    When we want only those cities that actually are in a municipality, I use a different query and it will use the index.
    SELECT T1.NAME as City, T2.NAME as Municipality
    FROM CITY T1, MUNICIPALITY T2
    WHERE SDO_RELATE(T1.GEOM, T2.GEOM, 'MASK=ANYINTERACT') = 'TRUE'I get (only) 2436 rows (as expected) in 5 seconds (it is fast) and the explain plan shows it is using the spatial index.
    But in this case, I am not getting any cities not inside any municipality (of course)
    SELECT STATEMENT
       NESTED LOOPS
          TABLE ACCESS                   MUNICIPALITY       FULL                22
          TABLE ACCESS                   CITY               BY INDEX ROWID      22
             DOMAIN INDEX                CITY_SDX                                0
                Access Predicates
                   MDSYS.SDO_RTREE_RELATE(T1.GEOM, T2.GEOM, 'mask=ANYINTERACT querytype=window ') = 'TRUE'I always thought a LEFT OUTER JOIN would return all rows from the Table, whatever happens in the next,
    but it seems the query has been rewritten so that it is now using a Filter Predicate in the end, which filters those geometries having no interaction.
    As an example I also do thing alphanumerically, I do get 4942 rows, including the ones which have no Municipality name.
    In this case the names must match, so its only for testing if the LEFT OUTER JOIN returns stuff correctly, which it does in this case.
    SELECT T1.NAME as City, T2.NAME as Municipality
    FROM CITY T1
    LEFT OUTER JOIN MUNICIPALITY T2 ON T1.NAME = T2.NAMEIs this an Oracle Spatial bug, e.g. not return 4942 rows, but only 2436 rows on the first query?
    Note all tests performed on Oracle 11g R2 (11.2.0.1.0)

    Patrick,
    Even so, your geoms in the relate were the wrong way around.
    Also, I don't recall you saying (or showing) that you wanted the municipality geometry returned. Still,
    no matter, easy to do.
    Here are some additional suggestions. I don't have your data so I have had to use some of my own.
    set serveroutput on timing on autotrace on
    SELECT T1.SPECIES as City,
           (SELECT T2.ADMIN_NAME FROM AUSTRALIAN_STATES T2 WHERE SDO_ANYINTERACT(T2.GEOM, SDO_GEOM.SDO_BUFFER(T1.GEOM,10000,0.5,'UNIT=M')) = 'TRUE') as Municipality,
           (SELECT T2.GEOM       FROM AUSTRALIAN_STATES T2 WHERE SDO_ANYINTERACT(T2.GEOM, SDO_GEOM.SDO_BUFFER(T1.GEOM,10000,0.5,'UNIT=M')) = 'TRUE') as geom
      FROM GUTDATA T1;
    762 rows selected
    Elapsed: 00:00:21.656
    Plan hash value: 2160035213
    | Id  | Operation                   | Name                       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |                            |   762 | 49530 |     5   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| AUSTRALIAN_STATES          |     1 |   115 |     0   (0)| 00:00:01 |
    |*  2 |   DOMAIN INDEX              | AUSTRALIAN_STATES_GEOM_SPX |       |       |     0   (0)| 00:00:01 |
    |   3 |  TABLE ACCESS BY INDEX ROWID| AUSTRALIAN_STATES          |     1 |   115 |     0   (0)| 00:00:01 |
    |*  4 |   DOMAIN INDEX              | AUSTRALIAN_STATES_GEOM_SPX |       |       |     0   (0)| 00:00:01 |
    |   5 |  TABLE ACCESS FULL          | GUTDATA                    |   762 | 49530 |     5   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("MDSYS"."SDO_ANYINTERACT"("T2"."GEOM","SDO_GEOM"."SDO_BUFFER"(:B1,10000,0.5,'UNIT=M'))='TRUE')
       4 - access("MDSYS"."SDO_ANYINTERACT"("T2"."GEOM","SDO_GEOM"."SDO_BUFFER"(:B1,10000,0.5,'UNIT=M'))='TRUE')
       Statistics
                   7  user calls
               24576  physical read total bytes
                   0  physical write total bytes
                   0  spare statistic 3
                   0  commit cleanout failures: cannot pin
                   0  TBS Extension: bytes extended
                   0  total number of times SMON posted
                   0  SMON posted for undo segment recovery
                   0  SMON posted for dropping temp segment
                   0  segment prealloc tasksThe above can look messy as you add more (SELECT ...) attributes, but is is fast (though can't use in Materialized Views).
    /* The set of all cities not in municipalities */
    SELECT T1.SPECIES                 as City,
           cast(null as varchar2(42)) as municipality,
           cast(null as sdo_geometry) as geom
      FROM GUTDATA T1
    WHERE NOT EXISTS (SELECT 1
                         FROM AUSTRALIAN_STATES T2
                        WHERE SDO_ANYINTERACT(T2.GEOM, SDO_GEOM.SDO_BUFFER(T1.GEOM,10000,0.5,'UNIT=M')) = 'TRUE')
    UNION ALL
    /* The set of all cities in municipalities */
    SELECT T1.SPECIES    as City,
           T2.ADMIN_NAME as Municipality,
           T2.GEOM       as geom
      FROM GUTDATA T1
           INNER JOIN
           AUSTRALIAN_STATES T2 ON (SDO_ANYINTERACT(T2.GEOM, SDO_GEOM.SDO_BUFFER(T1.GEOM,10000,0.5,'UNIT=M')) = 'TRUE');
    762 rows selected
    Elapsed: 00:00:59.953
    Plan hash value: 2854682795
    | Id  | Operation           | Name                       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT    |                            |    99 | 13450 |    38  (87)| 00:00:01 |
    |   1 |  UNION-ALL          |                            |       |       |            |          |
    |*  2 |   FILTER            |                            |       |       |            |          |
    |   3 |    TABLE ACCESS FULL| GUTDATA                    |   762 | 49530 |     5   (0)| 00:00:01 |
    |*  4 |    DOMAIN INDEX     | AUSTRALIAN_STATES_GEOM_SPX |       |       |     0   (0)| 00:00:01 |
    |   5 |   NESTED LOOPS      |                            |    61 | 10980 |    33   (0)| 00:00:01 |
    |   6 |    TABLE ACCESS FULL| AUSTRALIAN_STATES          |     8 |   920 |     3   (0)| 00:00:01 |
    |*  7 |    TABLE ACCESS FULL| GUTDATA                    |     8 |   520 |     4   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - filter( NOT EXISTS (SELECT 0 FROM "AUSTRALIAN_STATES" "T2" WHERE "MDSYS"."SDO_ANYINTERACT"("T2"."GEOM","SDO_GEOM"."SDO_BUFFER"(:B1,10000,0.5,'UNIT=M'))='TRUE'))
       4 - access("MDSYS"."SDO_ANYINTERACT"("T2"."GEOM","SDO_GEOM"."SDO_BUFFER"(:B1,10000,0.5,'UNIT=M'))='TRUE')
       7 - filter("MDSYS"."SDO_ANYINTERACT"("T2"."GEOM","SDO_GEOM"."SDO_BUFFER"("T1"."GEOM",10000,0.5,'UNIT=M'))='TRUE')
       Statistics
                   7  user calls
              131072  physical read total bytes
                   0  physical write total bytes
                   0  spare statistic 3
                   0  commit cleanout failures: cannot pin
                   0  TBS Extension: bytes extended
                   0  total number of times SMON posted
                   0  SMON posted for undo segment recovery
                   0  SMON posted for dropping temp segment
                   0  segment prealloc tasksMuch slower but Materialized View friendly.
    This one is a bit more "natural" but still slower than the first.
    set serveroutput on timing on autotrace on
    /* The set of all cities in municipalities */
    WITH municipal_cities As (
      SELECT T1.ID         as City,
             T2.ADMIN_NAME as Municipality,
             T2.GEOM       as geom
        FROM GUTDATA T1
             INNER JOIN
             AUSTRALIAN_STATES T2 ON (SDO_ANYINTERACT(T2.GEOM, SDO_GEOM.SDO_BUFFER(T1.GEOM,10000,0.5,'UNIT=M')) = 'TRUE')
    SELECT T1.ID           as City,
           T2.Municipality as Municipality,
           T2.GEOM         as geom
      FROM GUTDATA          T1
           LEFT OUTER JOIN
           municipal_cities T2
           ON (T2.CITY = T1.ID);
    762 rows selected
    Elapsed: 00:00:50.228
    Plan hash value: 745978991
    | Id  | Operation             | Name              | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT      |                   |   762 | 44196 |    36   (3)| 00:00:01 |
    |*  1 |  HASH JOIN RIGHT OUTER|                   |   762 | 44196 |    36   (3)| 00:00:01 |
    |   2 |   VIEW                |                   |    61 |  3294 |    33   (0)| 00:00:01 |
    |   3 |    NESTED LOOPS       |                   |    61 | 10980 |    33   (0)| 00:00:01 |
    |   4 |     TABLE ACCESS FULL | AUSTRALIAN_STATES |     8 |   920 |     3   (0)| 00:00:01 |
    |*  5 |     TABLE ACCESS FULL | GUTDATA           |     8 |   520 |     4   (0)| 00:00:01 |
    |   6 |   INDEX FAST FULL SCAN| GUTDATA_ID_PK     |   762 |  3048 |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - access("T2"."CITY"(+)="T1"."ID")
       5 - filter("MDSYS"."SDO_ANYINTERACT"("T2"."GEOM","SDO_GEOM"."SDO_BUFFER"("T1"."GEOM",10000,0.5,'UNIT=M'))='TRUE')
       Statistics
                   7  user calls
               49152  physical read total bytes
                   0  physical write total bytes
                   0  spare statistic 3
                   0  commit cleanout failures: cannot pin
                   0  TBS Extension: bytes extended
                   0  total number of times SMON posted
                   0  SMON posted for undo segment recovery
                   0  SMON posted for dropping temp segment
                   0  segment prealloc tasksFinally, the Pièce de résistance: trick the LEFT OUTER JOIN operator...
    set serveroutput on timing on autotrace on
    SELECT T1.SPECIES    as City,
           T2.ADMIN_NAME as Municipality,
           T2.GEOM       as geom
      FROM GUTDATA           T1
           LEFT OUTER JOIN
           AUSTRALIAN_STATES T2
           ON (t2.admin_name = to_char(t1.ID) OR
               SDO_ANYINTERACT(T2.GEOM, SDO_GEOM.SDO_BUFFER(T1.GEOM,10000,0.5,'UNIT=M')) = 'TRUE');
    762 rows selected
    Elapsed: 00:00:50.273
    Plan hash value: 158854308
    | Id  | Operation           | Name              | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT    |                   |   762 | 92964 |  2294   (1)| 00:00:28 |
    |   1 |  NESTED LOOPS OUTER |                   |   762 | 92964 |  2294   (1)| 00:00:28 |
    |   2 |   TABLE ACCESS FULL | GUTDATA           |   762 | 49530 |     5   (0)| 00:00:01 |
    |   3 |   VIEW              |                   |     1 |    57 |     3   (0)| 00:00:01 |
    |*  4 |    TABLE ACCESS FULL| AUSTRALIAN_STATES |     1 |   115 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       4 - filter("T2"."ADMIN_NAME"=TO_CHAR("T1"."ID") OR
                  "MDSYS"."SDO_ANYINTERACT"("T2"."GEOM","SDO_GEOM"."SDO_BUFFER"("T1"."GEOM",10000,0.5,'UNIT=M'))='TRUE')
       Statistics
                   7  user calls
                   0  physical read total bytes
                   0  physical write total bytes
                   0  spare statistic 3
                   0  commit cleanout failures: cannot pin
                   0  TBS Extension: bytes extended
                   0  total number of times SMON posted
                   0  SMON posted for undo segment recovery
                   0  SMON posted for dropping temp segment
                   0  segment prealloc tasksTry these combinations to see what works for you.
    Interestingly, for me, the following returns absolutely nothing.
    SELECT T1.SPECIES    as City,
           T2.ADMIN_NAME as Municipality
      FROM GUTDATA           T1
           LEFT OUTER JOIN
           AUSTRALIAN_STATES T2
           ON (SDO_ANYINTERACT(T2.GEOM, SDO_GEOM.SDO_BUFFER(T1.GEOM,10000,0.5,'UNIT=M')) = 'TRUE')
    MINUS
    SELECT T1.SPECIES    as City,
           T2.ADMIN_NAME as Municipality
      FROM GUTDATA           T1
           LEFT OUTER JOIN
           AUSTRALIAN_STATES T2
           ON (t2.admin_name =  to_char(t1.ID) OR
               SDO_ANYINTERACT(T2.GEOM, SDO_GEOM.SDO_BUFFER(T1.GEOM,10000,0.5,'UNIT=M')) = 'TRUE');(I leave it to you to see if you can see why as the LEFT OUTER JOIN seems to be working correctly for me but I am not going to dedicate time to detailed checking of results.)
    Note all tests performed on Oracle 11g R2 (11.2.0.1.0)
    If you get the answer you want: mark the post as answered to assign points.
    regards
    Simon

  • I am using a WD external hard drive for backing up my laptop with Time Machine, but I have to do it manually. How do I know when it has finished the back up? How long should it take?

    I am using an external WD hard drive for backing up my laptop. I have to do it manually, so I can't set Time Machine to just do it for me. How do I know when it is done backing up? How long should this take?

    Triple-click anywhere in the line below to select it:
    tmutil compare -E
    Copy the selected text to the Clipboard (command-C).
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V).
    The command will take at least a few minutes to run. Eventually some lines of output will appear below what you entered.
    Each line that begins with a plus sign (“+”) represents a file that has been added to the source volume since the last snapshot was taken. These files have not been backed up yet.
    Each line that begins with an exclamation point (“!”) represents a file that has changed on the source volume. These files have been backed up, but not in their present state.
    Each line that begins with a minus sign (“-“) represents a file that has been removed from the source volume.
    At the end of the output, you’ll get some lines like the following:
    Added:
    Removed:
    Changed:
    These lines show the total amount of data added, removed, or changed on the source(s) since the last snapshot.

  • Using indexes when using group by clause

    How can I make use of indexes when there is a group by clause in the sql/ pl/sql. Heard that when ever there is a group by clause , sql bypasses use of indexes. Is it true?
    Thanks in advance

    Hi,
    Depending on the query containing the group by, indexes will still be used.
    For example, create a big table based on the all_objects table. Then create an index on the object_type column. Then run this query:
    select count(*), object_type from big_table where object_type != 'PACKAGE' group by object_type
    The execution plan for this query will show the index to be used, the group by does not prevent the optimizer from using an index. Then run this query:
    select count(*), object_type from big_table group by object_type
    The execution plan for this query will show the index not to be used because the whole table - no restrictions - needs to be read to get the result.
    Hope this helps!
    Regards,
    Marco Stuijvenberg
    =
    www.marcostuijvenberg.nl

  • How to use variant in Query broadcasting?

    Hi,gurus here,we need to distribute report based on query daily to users.
    We hope the required-entry variable of query can be filled according logic such as curren day,curren month,etc. automatically.
    In General Precaculation tab of Setting new setting we can see 2 methods of Variable Assignment:
    Determine here
    Determine from variants
    Apparently Determine here can just distribute query report based on fix value, it does not serve our purpose.
    But in Determine from Variants,we can see nothing from Variant list(Just the first select value which is No Selection Possible). We also tried to define a variants in analyzer,but we can not see the variant here.
    So how to use it to serve our purpose of distribute query report to users daily with automatic required-entry value filled?

    Hi,
    Please refer the article from the below link, it contains all the steps and will erase all your doubts -
    [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/9075b11a-6e43-2c10-b7be-cfa0e97ec0cc?QuickLink=index&overridelayout=true]
    Hope this helps.
    Regards,
    RahulM

  • How to use xtags: when or xtags: if on variable id

    <!-- <xtags:variable id="data" context="<%=specs%>" select="//header/msds"/>
              <a href="/DATA/<%=data%> target="#">MSDS</a>
    -->
    My problem is if the value of data is null it gives the error page not found in the explorer but I want to href to some html file that for this item data is not there(actually data is holding a pdf file name if no file is attched to this item then i want to display the not data vailable for this item
    how I can use xtags: when
    xtags:otherwise doing checking on the id data
    Thanks

    Thanks for response
    I got the same code from xtags library but still the problem is
    <xtags:choose>
    <xtags:when test="firstName">
    Hello <xtags:valueOf select="@firstName"/>
    </xtags:when>
    <xtags:otherwise>
    Hello there friend
    </xtags:otherwise>
    </xtags:choose>
    I am not clear that this firstname is the is id or what
    I wanted to confirm that I have to use this whole code inside a xtage: variable
    like for example my code is
    *<xtags:variable id="msds" context="<%=specs%>" select="//header/msds"/>*
    I have to validate msds that if it has some value go for it other was I can provide ahtml file displaing no file i sthere

  • How to Name Fields when querying database?

    I am trying to query a database and then use "Split Fields" from data manipulation. The table I am querying has 100+ columns which has details about a User. I am able to automate perfectly the way I want.
    The only annoying piece is that when I try to query the published data from split fields, I have to look into the database and find the number and then add it here. Is there a way to name these fields in a friendly way - like Username, phone number, DOB,
    etc etc
    Regards, Vik Singh "If this thread answered your question, please click on "Mark as Answer"

    Hi,
    the Integration Pack for SQL form Kelverion is much more comfortable:
    http://www.kelverion.com/integration-packs/ip-sql-server/
    Regards,
    Stefan
    www.sc-orchestrator.eu ,
    Blog sc-orchestrator.eu

  • How to use Index, Match, or lookup for multi cell data..

    Hey all,  I'm new to using numbers (any spreadsheet really).  I can't figure out how to make this work.
    What I want to do for example is lookup a weight value in (F) by matching all the criteria in (A),(B),(C),(D) & (E).  If possible I would like my search criteria to match everything exactly except the Temp in (E).  The search temp can be warmer or greater than the temp listed. 
    I've tried using Index and Match together but I can't figure out how to match more than one valvue.  If all the other criteria is matched there should only be one weight to return.  I can match one criteria valvue but it only returns the first or last match.  I need it to match each item and return one weight.  What am I doing wrong??
    Please help, and keep it simple for the stupid me.
    Thanks

    The difficulty here is that MATCH and VLOOKUP return the values from the single row with the first match best fitting the type of match specified. VLOOKUP searches from the bottom of the column, MATCH form the top.
    I'd suggest a rearrangement of your data to allow a search with fewer steps.
    Since you want an exact match for the first four columns and a 'smallest value equal to or greater than' match for the fifth column I would suggest concatenating the values in columns A through E into a single value in a new column F inserted after column E.
    For the part of the data table shown, this concatenated value would remain the same for 13 rows, while the temperature ranges in five degree steps from -20 to +45, then a single three-degree step to 48.
    One value in those concatenated then changes, and the new concatenated value repeats for the next 13 rows with the temperature passing through the same range with the same steps.
    If this pattern is consistent (or even reasonably consistent) through the whole table. then a rearrangement of the data as shown below will greatly reduce table size and search time.
    Each distinct set of values A though D is presented on only a single row, the four values are concatenated in column E, and are followed by the temperature values, one per column, in the header row, with the associated weights for those conditions and that temperature listed across that row.
    Note: weights in row 2 (runway 13) are taken from your table. Boredom with retyping then set in, so those in row 2 (runway 31) are formula generated to present a series of decreasing weights, but bear no other relation to those in your table.
    With the table presented in this form, the search is reduced to a single OFFSET expression, with the ROW offset determined by matching the concatenated value of columns A-D of the Query table with their exact counterpart in the Data table, and the column offset determined by matching the temperature in the Query with its closest less than or equal to match in row 1 of Data.
    Formula:
    Query::F2: =OFFSET(Data :: $A$1,MATCH(A&B&C&D,Data :: $E,0)-1,MATCH(E,Data :: $1:$1,1)-1)
    Not handled: What do you want returned for temperatures less than -20 or greater than +48 degrees? As written, the formula will return a not found error for -21 and below, and the value associated with 48° for 49 and above.
    Regards,
    Barry

  • How to use one af:query for multiple VOs

    Hi all,
    How can we use an af:query component to query on multiple VOs?
    Think of a page with search area and a tabbed pannel with two tables based on different view objects.
    Any ideas?
    Thanks
    Version
    ADF Business Components 11.1.1.56.60
    Java(TM) Platform 1.6.0_18
    Oracle IDE 11.1.1.3.37.56.60
    Edited by: Barbara Gelabert on 28-dic-2010 6:55

    Hi Santosh,
    Not yet implemented, but I was thinking on overriding the query listener and creating a view critera on the second view object as a copy of the first one. That involves capturing operands, operators and values set and then applying the criteria and executing the query.
    Anyway, in case you don't need complex operators in the search area but can add them as where clauses to the query statement, you can use search forms instead of query components as Shay Shmeltzer suggests in [url http://blogs.oracle.com/shay/2010/12/combining_multiple_queries_and.html?goback=.gde_1002457_news_308820955]his post.
    Regards,
    Barbara

  • How to use methods when objects stored in a linked list?

    Hi friend:
    I stored a series of objects of certain class inside a linked list. When I get one of them out of the list, I want to use the instance method associated with this object. However, the complier only allow me to treat this object as general object, ( of Object Class), as a result I can't use instance methods which are associated with this object. Can someone tell me how to use the methods associated with the objects which are stored inside a linked list?
    Here is my code:
    import java.util.*;
    public class QueueW
         LinkedList qList;
         public QueueW(Collection s) //Constructor of QuequW Class
              qList = new LinkedList(s); //Declare an object linked list
         public void addWaiting(WaitingList w)
         boolean result = qList.isEmpty(); //true if list contains no elements
              if (result)
              qList.addFirst(w);
              else
              qList.add(w);
         public int printCid()
         Object d = qList.getFirst(); // the complier doesn't allow me to treat d as a object of waitingList class
              int n = d.getCid(); // so I use "Object d"
         return n; // yet object can't use getCid() method, so I got error in "int n = d.getCid()"
         public void removeWaiting(WaitingList w)
         qList.removeFirst();
    class WaitingList
    int cusmNo;
    String cusmName;
    int cid;
    private static int id_count = 0;
         /* constructor */
         public WaitingList(int c, String cN)
         cusmNo = c;
         cusmName = cN;
         cid = ++id_count;
         public int getCid() //this is the method I want to use
         return cid;

    Use casting. In other words, cat the object taken from the collection to the correct type and call your method.
       HashMap map = /* ... */;
       map.put(someKey, myObject);
       ((MyClass)(map.get(someKey)).myMethod();Chuck

Maybe you are looking for