Sort in the query (7.0)?

Hi Experts,
In the query it is sorting by Document number. I changed the properties of the individual characteristic to sort by posting date. But it is not working any idea?
Thanks in advance.
Sharat.

Can anybody answer this question?
Thanks.

Similar Messages

  • Any way to set the sort order other than in the query?

    The report has an OrderBy parameter so the user can select which field is used for sorting. The query has an OrderBy clause referencing the parameter. The problem is that it doesn't always pay any attention to the parameter. (Since it appears to be intermittent my suspicion is that it really never pays any attention to it but that sometimes whatever actually is determining the order gives the same results.)
    The problem is that putting an OrderBy clause in a query is the only way I know of to determine the output order of a report. Is there any other way?
    Thanks.

    Unfortunately Break Order doesn't seem to be controlling the sort order. I found that the value was set on numerous fields but I've changed them all to None & it still isn't displaying in the order specified by the OrderBy parameter.
    Note that this is a 'form layout' report with one page/record so it doesn't really have columns-but the pages are supposed to be printed in the order chosen by the user from a list of values. It doesn't seem to matter what's selected from that list though, the output appears in the same order as if no Order By clause is specified.
    Can you think of anything else that would cause the report to ignore the order by clause?
    thanks.

  • Error in SQL Query The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator. for the query

    hi Experts,
    while running SQL Query i am getting an error as
    The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator. for the query
    select  T1. Dscription,T1.docEntry,T1.Quantity,T1.Price ,
    T2.LineText
    from OQUT T0  INNER JOIN QUT1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN
    QUT10 T2 ON T1.DocEntry = T2.DocEntry where T1.DocEntry='590'
    group by  T1. Dscription,T1.docEntry,T1.Quantity,T1.Price
    ,T2.LineText
    how to resolve the issue

    Dear Meghanath,
    Please use the following query, Hope your purpose will serve.
    select  T1. Dscription,T1.docEntry,T1.Quantity,T1.Price ,
    CAST(T2.LineText as nvarchar (MAX))[LineText]
    from OQUT T0  INNER JOIN QUT1 T1 ON T0.DocEntry = T1.DocEntry LEFT OUTER JOIN
    QUT10 T2 ON T1.DocEntry = T2.DocEntry --where T1.DocEntry='590'
    group by  T1. Dscription,T1.docEntry,T1.Quantity,T1.Price
    ,CAST(T2.LineText as nvarchar (MAX))
    Regards,
    Amit

  • How to Sort by the length of the returned value from a query.

    Hi,
    I was wondering if it is possible to sort by the length of the returned value from a query?
    For example if I want to get a list of people with the name 'Samuel', I would like to short by how short the length of the whole name is.
    Sort by length of the name in SQL
    Samuel Syda
    Samuel Indranaka
    Samuel Johnsons
    Samuel Longhenderson
    Thank you.

    Hi,
    Sorting is done by an ORDER BY clause at the end of the main query.
    In most cases, you can ORDER BY any expression, even f it is not in the SELECT clause.  In this case, it sounds like you just need:
    ORDER BY  LENGTH (name_column)
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    Post your query, using an ORDER BY clause like the one above, and point out where that query is producing the wrong results, and explain, using specific examples, how you get the right results from the given data in those places.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Help needed to tune the Query:Statistics added

    Can someone DBA please help me to tune this query:
    SELECT DISTINCT K.ATTRIBUTE_VALUE AGENCY_ID,B.PROFILE_NM ,NVL(G.OFFICE_DESC,'--') OFFICE_DESC,f.OFFICE_ID,B.PROFILE_ID,'%' ROLE,'%' LAYOUT,
    CASE
    WHEN 'flagB' = '%' THEN
    NVL(J.ISS_GRP_DESC,'BILLING')
    WHEN 'flagO' = '%' THEN
    NVL(J.ISS_GRP_DESC,'ORDERING')
    WHEN 'flag' = '%' THEN
    NVL(J.ISS_GRP_DESC,'BILLING/ORDERING')
    ELSE
    NVL(J.ISS_GRP_DESC,' ')
    END ISS_GRP_DESC,
    DECODE(NVL(H.USERID,' ') ,' ','--','<a sbcuid_in=' || H.USERID || ' target=NEW >'||H.FIRSTNAME || ' ' || H.LASTNAME || '( ' || H.USERID || ' )</a>' ) USER_NAME
    FROM
    PROFILE_PORTAL B ,
    TBL_BDA_AGENCY_RESP_REP C ,
    TBL_BDA_AGENCY_OFFICE F,
    TBL_BDA_OFFICE G,
    USERS_PORTAL H,
    TBL_BDA_USR_ISS_GRP I ,
    TBL_BDA_ISS_GROUP J,
    ATTRIBUTE_VALUES_PORTAL K,
    PROFILE_TYPE_PORTAL L
    WHERE
    B.PROFILE_ID = F.AGENCY_ID (+)
    AND B.PROFILE_ID = C.AGENCY_ID (+)
    AND G.OFFICE_ID (+)= F.OFFICE_ID
    AND H.USERID (+)= C.RESP_USR_ID
    AND C.ISS_GRP_ID = I.ISS_GRP_ID (+)
    AND I.ISS_GRP_ID = J.ISS_GRP_ID(+)
    AND 'PROFILE.'||B.PROFILE_ID = K.ENTITY_ID(+)
    AND K.ATTRIBUTE_VALUE IS NOT NULL
    AND L.PROFILE_TYPE_ID = B.PROFILE_TYPE_ID
    AND L.APPLICATION_CD='BDA'
    AND NOT EXISTS (SELECT agency_id
    FROM TBL_BDA_AGENCY_RESP_REP t
    WHERE t.ISS_GRP_ID IN ('%')
    AND t.AGENCY_ID = C.AGENCY_ID)
    AND K.ATTRIBUTE_VALUE LIKE '%'
    AND UPPER(B.PROFILE_NM) LIKE UPPER('%')
    AND (to_char(NVL(B.PROFILE_ID,0)) LIKE '%' OR NVL(B.PROFILE_ID,0) IN ('a'))
    AND NVL(G.OFFICE_ID,0) IN ('%')
    AND (to_char(NVL(C.RESP_USR_ID,'0')) LIKE '%' OR NVL(C.RESP_USR_ID,'0') IN ('k'))
    ORDER BY PROFILE_NM
    The number of rows in these tables are as follows:
    PROFILE_PORTAL -- 2392
    TBL_BDA_AGENCY_RESP_REP 3508
    TBL_BDA_AGENCY_OFFICE 2151
    TBL_BDA_OFFICE 3
    USERS_PORTAL 270500
    TBL_BDA_USR_ISS_GRP 234
    TBL_BDA_ISS_GROUP 2
    ATTRIBUTE_VALUES_PORTAL 2790
    PROFILE_TYPE_PORTAL 3
    The Explain pal nhas given this o/p to me:
    SQL> select * from table(dbms_xplan.display) dual;
    PLAN_TABLE_OUTPUT
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost |
    | 0 | SELECT STATEMENT | | 807 | 102K| | 2533 |
    | 1 | SORT UNIQUE | | 807 | 102K| 232K| 82 |
    |* 2 | FILTER | | | | | |
    |* 3 | HASH JOIN OUTER | | 807 | 102K| | 52 |
    |* 4 | HASH JOIN OUTER | | 807 | 95226 | | 40 |
    |* 5 | TABLE ACCESS BY INDEX ROWID | ATTRIBUTE_VALUES | 1 | 23 | | 2 |
    | 6 | NESTED LOOPS | | 7 | 805 | | 37 |
    | 7 | NESTED LOOPS OUTER | | 6 | 552 | | 25 |
    |* 8 | FILTER | | | | | |
    | 9 | NESTED LOOPS OUTER | | | | | |
    |* 10 | FILTER | | | | | |
    | 11 | NESTED LOOPS OUTER | | | | | |
    | 12 | NESTED LOOPS OUTER | | 3 | 141 | | 10 |
    |* 13 | HASH JOIN | | 3 | 120 | | 7 |
    |* 14 | TABLE ACCESS FULL | PROFILE | 6 | 198 | | 4 |
    |* 15 | TABLE ACCESS FULL | PROFILE_TYPE | 1 | 7 | | 2 |
    |* 16 | INDEX RANGE SCAN | SYS_C0019777 | 1 | 7 | | 1 |
    | 17 | TABLE ACCESS BY INDEX ROWID| TBL_BDA_OFFICE | 1 | 10 | | 1 |
    |* 18 | INDEX UNIQUE SCAN | SYS_C0019800 | 1 | | | |
    | 19 | TABLE ACCESS BY INDEX ROWID | TBL_BDA_AGENCY_RESP_REP | 2 | 26 | | 2 |
    |* 20 | INDEX RANGE SCAN | IDX_AGECYRESP_AGNCYID | 2 | | | 1 |
    | 21 | TABLE ACCESS BY INDEX ROWID | USER_ | 1 | 22 | | 1 |
    |* 22 | INDEX UNIQUE SCAN | USER_PK | 1 | | | |
    |* 23 | INDEX RANGE SCAN | IDX_ATTVAL_ENTATTID | 1 | | | 1 |
    | 24 | TABLE ACCESS FULL | TBL_BDA_USR_ISS_GRP | 234 | 702 | | 2 |
    | 25 | TABLE ACCESS FULL | TBL_BDA_ISS_GROUP | 2 | 24 | | 2 |
    |* 26 | TABLE ACCESS BY INDEX ROWID | TBL_BDA_AGENCY_RESP_REP | 1 | 7 | | 3 |
    |* 27 | INDEX RANGE SCAN | IDX_AGECYRESP_AGNCYID | 2 | | | 1 |
    Predicate Information (identified by operation id):
    2 - filter( NOT EXISTS (SELECT /*+ */ 0 FROM "TBL_BDA_AGENCY_RESP_REP" "T" WHERE "T"."AGENCY_ID"=:B1
    AND "T"."ISS_GRP_ID"=TO_NUMBER('%')))
    3 - access("I"."ISS_GRP_ID"="J"."ISS_GRP_ID"(+))
    4 - access("SYS_ALIAS_1"."ISS_GRP_ID"="I"."ISS_GRP_ID"(+))
    5 - filter("K"."ATTRIBUTE_VALUE" IS NOT NULL AND "K"."ATTRIBUTE_VALUE" LIKE '%')
    8 - filter(NVL("SYS_ALIAS_1"."RESP_USR_ID",'0') LIKE '%' OR NVL("SYS_ALIAS_1"."RESP_USR_ID",'0')='k')
    10 - filter(NVL("G"."OFFICE_ID",0)=TO_NUMBER('%'))
    13 - access("L"."PROFILE_TYPE_ID"="B"."PROFILE_TYPE_ID")
    14 - filter(UPPER("B"."PROFILE_NM") LIKE '%' AND (TO_CHAR(NVL("B"."PROFILE_ID",0)) LIKE '%' OR
    NVL("B"."PROFILE_ID",0)=TO_NUMBER('a')))
    15 - filter("L"."APPLICATION_CD"='BDA')
    16 - access("B"."PROFILE_ID"="F"."AGENCY_ID"(+))
    18 - access("G"."OFFICE_ID"(+)="F"."OFFICE_ID")
    20 - access("B"."PROFILE_ID"="SYS_ALIAS_1"."AGENCY_ID"(+))
    22 - access("H"."USERID"(+)="SYS_ALIAS_1"."RESP_USR_ID")
    23 - access("K"."ENTITY_ID"='PROFILE.'||TO_CHAR("B"."PROFILE_ID"))
    26 - filter("T"."ISS_GRP_ID"=TO_NUMBER('%'))
    27 - access("T"."AGENCY_ID"=:B1)
    Note: cpu costing is off
    57 rows selected.
    Elapsed: 00:00:01.08
    Please help me.
    Aashish S.

    Hello Eric,
    Here is the code:
    SELECT DISTINCT
    K.ATTRIBUTE_VALUE AGENCY_ID,
    B.PROFILE_NM ,
    NVL(G.OFFICE_DESC,'--') OFFICE_DESC,
    f.OFFICE_ID,
    B.PROFILE_ID,
    '%' ROLE,
    '%' LAYOUT,
    case
    WHEN 'flagB' = '%' THEN
    NVL(J.ISS_GRP_DESC,'BILLING')
    WHEN 'flagO' = '%' THEN
    NVL(J.ISS_GRP_DESC,'ORDERING')
    WHEN 'flag' = '%' THEN
    NVL(J.ISS_GRP_DESC,'BILLING/ORDERING')
    else
    NVL(J.ISS_GRP_DESC,' ')
    END ISS_GRP_DESC,
    DECODE(NVL(H.USERID,' ') ,' ','--','&lt;a sbcuid_in=' || H.USERID || ' target=NEW &gt;'||H.FIRSTNAME || ' ' || H.LASTNAME ||
    '( ' || H.USERID || ' )&lt;/a&gt;' ) USER_NAME
    from
    PROFILE_PORTAL B ,
    TBL_BDA_AGENCY_RESP_REP C ,
    TBL_BDA_AGENCY_OFFICE F,
    TBL_BDA_OFFICE G,
    USERS_PORTAL H,
    TBL_BDA_USR_ISS_GRP I ,
    TBL_BDA_ISS_GROUP J,
    ATTRIBUTE_VALUES_PORTAL K,
    PROFILE_TYPE_PORTAL L
    WHERE
    B.PROFILE_ID = F.AGENCY_ID (+)
    AND B.PROFILE_ID = C.AGENCY_ID (+)
    AND G.OFFICE_ID (+)= F.OFFICE_ID
    AND H.USERID (+)= C.RESP_USR_ID
    AND C.ISS_GRP_ID = I.ISS_GRP_ID (+)
    AND I.ISS_GRP_ID = J.ISS_GRP_ID(+)
    AND 'PROFILE.'||B.PROFILE_ID = K.ENTITY_ID(+)
    AND K.ATTRIBUTE_VALUE IS NOT NULL
    AND L.PROFILE_TYPE_ID = B.PROFILE_TYPE_ID
    AND L.APPLICATION_CD='BDA'
    AND NOT EXISTS
    (SELECT agency_id
    FROM TBL_BDA_AGENCY_RESP_REP t
    WHERE t.ISS_GRP_ID IN (1)
    AND t.AGENCY_ID = C.AGENCY_ID)
    AND K.ATTRIBUTE_VALUE LIKE '%'
    AND UPPER(B.PROFILE_NM) LIKE UPPER('%')
    AND (to_char(NVL(B.PROFILE_ID,0))
    LIKE '%'
    OR NVL(B.PROFILE_ID,0) IN (1))
    AND NVL(G.OFFICE_ID,0) IN (1)
    AND (to_char(NVL(C.RESP_USR_ID,'0'))
    LIKE '%'
    OR NVL(C.RESP_USR_ID,'0') IN ('%'))
    ORDER BY PROFILE_NM
    This is the Query and the query takes some mins. to run in prod environment.
    From the Query plan ,I am not able to get any idea for optimization.
    Now,Can you tell me which steps I need to follow to run it faster and which all modifications should be made?
    Thanks.
    Aashish S.

  • How to improve the query performance or tune query from Explain Plan

    Hi
    The following is my explain plan for sql query. (The plan is generated by Toad v9.7). How to fix the query?
    SELECT STATEMENT ALL_ROWSCost: 4,160 Bytes: 25,296 Cardinality: 204                                         
         8 NESTED LOOPS Cost: 3 Bytes: 54 Cardinality: 1                                    
              5 NESTED LOOPS Cost: 2 Bytes: 23 Cardinality: 1                               
                   2 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 13 Cardinality: 1                          
                        1 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1                     
                   4 TABLE ACCESS BY INDEX ROWID TABLE AR.HZ_CUST_ACCOUNTS Cost: 1 Bytes: 10 Cardinality: 1                          
                        3 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.HZ_CUST_ACCOUNTS_U1 Cost: 1 Cardinality: 1                     
              7 TABLE ACCESS BY INDEX ROWID TABLE AR.HZ_PARTIES Cost: 1 Bytes: 31 Cardinality: 1                               
                   6 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.HZ_PARTIES_U1 Cost: 1 Cardinality: 1                          
         10 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 12 Cardinality: 1                                    
              9 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1                               
         15 NESTED LOOPS Cost: 2 Bytes: 29 Cardinality: 1                                    
              12 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 12 Cardinality: 1                               
                   11 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1                          
              14 TABLE ACCESS BY INDEX ROWID TABLE ONT.OE_ORDER_HEADERS_ALL Cost: 1 Bytes: 17 Cardinality: 1                               
                   13 INDEX RANGE SCAN INDEX (UNIQUE) ONT.OE_ORDER_HEADERS_U2 Cost: 1 Cardinality: 1                          
         21 FILTER                                    
              16 TABLE ACCESS FULL TABLE ONT.OE_TRANSACTION_TYPES_TL Cost: 2 Bytes: 1,127 Cardinality: 49                               
              20 NESTED LOOPS Cost: 2 Bytes: 21 Cardinality: 1                               
                   18 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 12 Cardinality: 1                          
                        17 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1                     
                   19 INDEX RANGE SCAN INDEX (UNIQUE) ONT.OE_ORDER_HEADERS_U2 Cost: 1 Bytes: 9 Cardinality: 1                          
         23 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 12 Cardinality: 1                                    
              22 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1                               
         45 NESTED LOOPS Cost: 4,160 Bytes: 25,296 Cardinality: 204                                    
              42 NESTED LOOPS Cost: 4,150 Bytes: 23,052 Cardinality: 204                               
                   38 NESTED LOOPS Cost: 4,140 Bytes: 19,992 Cardinality: 204                          
                        34 NESTED LOOPS Cost: 4,094 Bytes: 75,850 Cardinality: 925                     
                             30 NESTED LOOPS Cost: 3,909 Bytes: 210,843 Cardinality: 3,699                
                                  26 PARTITION LIST ALL Cost: 2,436 Bytes: 338,491 Cardinality: 14,717 Partition #: 29 Partitions accessed #1 - #18          
                                       25 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_AE_HEADERS Cost: 2,436 Bytes: 338,491 Cardinality: 14,717 Partition #: 29 Partitions accessed #1 - #18     
                                            24 INDEX SKIP SCAN INDEX XLA.XLA_AE_HEADERS_N1 Cost: 264 Cardinality: 1,398,115 Partition #: 29 Partitions accessed #1 - #18
                                  29 PARTITION LIST ITERATOR Cost: 1 Bytes: 34 Cardinality: 1 Partition #: 32           
                                       28 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_AE_LINES Cost: 1 Bytes: 34 Cardinality: 1 Partition #: 32      
                                            27 INDEX RANGE SCAN INDEX (UNIQUE) XLA.XLA_AE_LINES_U1 Cost: 1 Cardinality: 1 Partition #: 32
                             33 PARTITION LIST ITERATOR Cost: 1 Bytes: 25 Cardinality: 1 Partition #: 35                
                                  32 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_DISTRIBUTION_LINKS Cost: 1 Bytes: 25 Cardinality: 1 Partition #: 35           
                                       31 INDEX RANGE SCAN INDEX XLA.XLA_DISTRIBUTION_LINKS_N3 Cost: 1 Cardinality: 1 Partition #: 35      
                        37 PARTITION LIST SINGLE Cost: 1 Bytes: 16 Cardinality: 1 Partition #: 38                     
                             36 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_EVENTS Cost: 1 Bytes: 16 Cardinality: 1 Partition #: 39 Partitions accessed #2               
                                  35 INDEX UNIQUE SCAN INDEX (UNIQUE) XLA.XLA_EVENTS_U1 Cost: 1 Cardinality: 1 Partition #: 40 Partitions accessed #2          
                   41 PARTITION LIST SINGLE Cost: 1 Bytes: 15 Cardinality: 1 Partition #: 41                          
                        40 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_TRANSACTION_ENTITIES Cost: 1 Bytes: 15 Cardinality: 1 Partition #: 42 Partitions accessed #2                    
                             39 INDEX UNIQUE SCAN INDEX (UNIQUE) XLA.XLA_TRANSACTION_ENTITIES_U1 Cost: 1 Cardinality: 1 Partition #: 43 Partitions accessed #2               
              44 TABLE ACCESS BY INDEX ROWID TABLE GL.GL_CODE_COMBINATIONS Cost: 1 Bytes: 11 Cardinality: 1                               
                   43 INDEX UNIQUE SCAN INDEX (UNIQUE) GL.GL_CODE_COMBINATIONS_U1 Cost: 1 Cardinality: 1

    damorgan wrote:
    Tuning is NOT about reducing the cost of i/o.
    i/o is only one of many contributors to cost and only one of many contributors to waits.
    Any time you would like to explore this further run this code:
    SELECT 1 FROM dual
    WHERE regexp_like(' ','^*[ ]*a');but not on a production box because you are going to experience an extreme tuning event with zero i/o.
    And when I say "extreme" I mean "EXTREME!"
    You've been warned.I think you just need a faster server.
    SQL> set autotrace traceonly statistics
    SQL> set timing on
    SQL> select 1 from dual
      2  where
      3  regexp_like   (' ','^*[ ]*a');
    no rows selected
    Elapsed: 00:00:00.00
    Statistics
              1  recursive calls
              0  db block gets
              0  consistent gets
              0  physical reads
              0  redo size
            243  bytes sent via SQL*Net to client
            349  bytes received via SQL*Net from client
              1  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              0  rows processedRepeated from an Oracle 10.2.0.x instance:
    SQL> SELECT DISTINCT SID FROM V$MYSTAT;
           SID
           310
    SQL> ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT FOREVER, LEVEL 1';
    Session altered.
    SQL> select 1 from dual
      2  where
      3  regexp_like   (' ','^*[ ]*a');The session is hung. Wait a little while and connect to the database using a different session:
    COLUMN STAT_NAME FORMAT A35 TRU
    SET PAGESIZE 200
    SELECT
      STAT_NAME,
      VALUE
    FROM
      V$SESS_TIME_MODEL
    WHERE
      SID=310;
    STAT_NAME                                VALUE
    DB time                                   9247
    DB CPU                                    9247
    background elapsed time                      0
    background cpu time                          0
    sequence load elapsed time                   0
    parse time elapsed                        6374
    hard parse elapsed time                   5997
    sql execute elapsed time                  2939
    connection management call elapsed        1660
    failed parse elapsed time                    0
    failed parse (out of shared memory)          0
    hard parse (sharing criteria) elaps          0
    hard parse (bind mismatch) elapsed           0
    PL/SQL execution elapsed time               95
    inbound PL/SQL rpc elapsed time              0
    PL/SQL compilation elapsed time              0
    Java execution elapsed time                  0
    repeated bind elapsed time                  48
    RMAN cpu time (backup/restore)               0Seems to be using a bit of time for the hard parse (hard parse elapsed time). Wait a little while, then re-execute the query:
    STAT_NAME                                VALUE
    DB time                                   9247
    DB CPU                                    9247
    background elapsed time                      0
    background cpu time                          0
    sequence load elapsed time                   0
    parse time elapsed                        6374
    hard parse elapsed time                   5997
    sql execute elapsed time                  2939
    connection management call elapsed        1660
    failed parse elapsed time                    0
    failed parse (out of shared memory)          0
    hard parse (sharing criteria) elaps          0
    hard parse (bind mismatch) elapsed           0
    PL/SQL execution elapsed time               95
    inbound PL/SQL rpc elapsed time              0
    PL/SQL compilation elapsed time              0
    Java execution elapsed time                  0
    repeated bind elapsed time                  48
    RMAN cpu time (backup/restore)               0The session is not reporting additional CPU usage or parse time.
    Let's check one of the session's statistics:
    SELECT
      SS.VALUE
    FROM
      V$SESSTAT SS,
      V$STATNAME SN
    WHERE
      SN.NAME='consistent gets'
      AND SN.STATISTIC#=SS.STATISTIC#
      AND SS.SID=310;
         VALUE
           163Not many consistent gets after 20+ minutes.
    Let's take a look at the plan:
    SQL> SELECT SQL_ID,CHILD_NUMBER FROM V$SQL WHERE SQL_TEXT LIKE 'select 1 from du
    al%';
    SQL_ID        CHILD_NUMBER
    04mpgrzhsv72w            0
    SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR('04mpgrzhsv72w',0,'TYPICAL'))
    select 1 from dual where regexp_like   (' ','^*[ ]*a')
    NOTE: cannot fetch plan for SQL_ID: 04mpgrzhsv72w, CHILD_NUMBER: 0
          Please verify value of SQL_ID and CHILD_NUMBER;
          It could also be that the plan is no longer in cursor cache (check v$sql_p
    lan)No plan...
    Let's take a look at the 10053 trace file:
    Registered qb: SEL$1 0x19157f38 (PARSER)
      signature (): qb_name=SEL$1 nbfros=1 flg=0
        fro(0): flg=4 objn=258 hint_alias="DUAL"@"SEL$1"
    Predicate Move-Around (PM)
    PM: Considering predicate move-around in SEL$1 (#0).
    PM:   Checking validity of predicate move-around in SEL$1 (#0).
    CBQT: Validity checks failed for 7uqx4guu04x3g.
    CVM: Considering view merge in query block SEL$1 (#0)
    CBQT: Validity checks failed for 7uqx4guu04x3g.
    Subquery Unnest
    SU: Considering subquery unnesting in query block SEL$1 (#0)
    Set-Join Conversion (SJC)
    SJC: Considering set-join conversion in SEL$1 (#0).
    Predicate Move-Around (PM)
    PM: Considering predicate move-around in SEL$1 (#0).
    PM:   Checking validity of predicate move-around in SEL$1 (#0).
    PM:     PM bypassed: Outer query contains no views.
    FPD: Considering simple filter push in SEL$1 (#0)
    FPD:   Current where clause predicates in SEL$1 (#0) :
              REGEXP_LIKE (' ','^*[ ]*a')
    kkogcp: try to generate transitive predicate from check constraints for SEL$1 (#0)
    predicates with check contraints:  REGEXP_LIKE (' ','^*[ ]*a')
    after transitive predicate generation:  REGEXP_LIKE (' ','^*[ ]*a')
    finally:  REGEXP_LIKE (' ','^*[ ]*a')
    apadrv-start: call(in-use=592, alloc=16344), compile(in-use=37448, alloc=42256)
    kkoqbc-start
                : call(in-use=592, alloc=16344), compile(in-use=38336, alloc=42256)
    kkoqbc-subheap (create addr=000000001915C238)Looks like the query never had a chance to start executing - it is still parsing after 20 minutes.
    I am not sure that this is a good example - the query either executes very fast, or never has a chance to start executing. But, it might still make your point physical I/O is not always the problem when performance problems are experienced.
    Charles Hooper
    IT Manager/Oracle DBA
    K&M Machine-Fabricating, Inc.

  • Sorting for the procedure is not working

    can you help why the sorting is not working here.I am running the below procedure to sort asc and desc and when I do sort in descending order by a different column it gives me a different rows sorted in desc order. what i
    want the proecdure to do it to sort the recordset in asc and desc order without changing the selected rows
    SQL>  exec trnsportitems.gettrnsportitems(1,10,'itemnumber desc', :n, :c);
    PL/SQL procedure successfully completed.
    SQL> print c;
    ITEMNUMBER              R IDESCR                                   IDESCRL                                                      IUNI IS I ITEM
    2011.601/00002          1 TUNNEL CONSTRUCTION LAYOUT STAKING       TUNNEL CONSTRUCTION LAYOUT STAKING                           LS   0
    2011.601/00003          2 CONSTRUCTION SURVEYING                   CONSTRUCTION SURVEYING                                       LS   05 N 2011601/00003
    2011.601/00010          3 VIBRATION MONITORING                     VIBRATION MONITORING                                         LS   05 N 2011601/00010
    2011.601/00020          4 REVISED BRIDGE PLANS                     REVISED BRIDGE PLANS                                         LS   05 N 2011601/00020
    2011.601/00040          5 DESIGN                                   DESIGN                                                       LS   05 N 2011601/00040
    2011.601/00050          6 DESIGN AND CONSTRUCT                     DESIGN AND CONSTRUCT                                         LS   05 N 2011601/00050
    2011.601/08010          7 SUPPLEMENTAL DESCRIPTION                 SUPPLEMENTAL DESCRIPTION                                     LS   05 N 2011601/08010
    2011.601/08011          8 SUPPLEMENTAL DESCRIPTION                 SUPPLEMENTAL DESCRIPTION                                     LS   05 N 2011601/08011
    2011.601/08012          9 SUPPLEMENTAL DESCRIPTION                 SUPPLEMENTAL DESCRIPTION                                     LS   05 N 2011601/08012
    2011.601/08013         10 SUPPLEMENTAL DESCRIPTION                 SUPPLEMENTAL DESCRIPTION                                     LS   05 N 2011601
    10 rows selected.
    SQL>
    SQL>  exec trnsportitems.gettrnsportitems(1,10,'idescr DESC', :n, :c);
    PL/SQL procedure successfully completed.
    SQL> print c;
    ITEMNUMBER              R IDESCR                                   IDESCRL                                                      IUNI IS I ITEM
    2563.613/00040          1 YELLOW TUBE DELINEATORS                  YELLOW TUBE DELINEATORS                                      UDAY 05 N 2563613/00040
    2563.602/00100          2 YELLOW TUBE DELINEATOR                   YELLOW TUBE DELINEATOR                                       EACH 05 N 2563602/00100
    2565.602/00940          3 YELLOW LED INDICATION                    YELLOW LED INDICATION                                        EACH 05 N 2565602/00940
    2502.602/00040          4 YARD DRAIN                               YARD DRAIN                                                   EACH 05 N 2502602/00040
    2411.601/00030          5 WYE STRUCTURE                            WYE STRUCTURE                                                LS   05 N 2411601/00030
    2557.603/00041          6 WOVEN WIRE FENCE                         WOVEN WIRE FENCE                                             L F  05 N 2557603/00041
    2557.603/00043          7 WOVEN WIRE                               WOVEN WIRE                                                   L F  05 N 2557603/00043
    2563.613/00615          8 WORK ZONE SPEED LIMIT SIGN               WORK ZONE SPEED LIMIT SIGN                                   UDAY 05 N 2563613/00
    2563.613/00610          9 WORK ZONE SPEED LIMIT                    WORK ZONE SPEED LIMIT                                        UDAY 05 N 2563613/00610
    2557.603/00035         10 WOODEN FENCE                             WOODEN FENCE                                                 L F  05 N 2557603/00035
    10 rows selected.

    Hi,
    user13258760 wrote:
    can you help why the sorting is not working here.I am running the below procedure to sort asc and desc and when I do sort in descending order by a different column it gives me a different rows sorted in desc order. what i
    want the proecdure to do it to sort the recordset in asc and desc order without changing the selected rowsAs it is written now, the argument insortexp has nothing to do with the order of the rows. It is used only in computing column r, and column r is used only in the WHERE clause.
    Are you really saying you don't want a WHERE clause at all in the main query: that you always want the cursor to contain all rows from itemlist that meet the 3 hard-coded conditions:
    ...                     WHERE item  '2999509/00001'     -- Did you mean != here?
                              AND iobselet = 'N'
                              AND ispecyr = '05'?
    If so, change the main query WHERE clause:
    WHERE r BETWEEN instartrowindex AND inendrowindexinto an ORDER BY clause:
    ORDER BY  rBy the way, you might want to make insortexp case-insensitive.
    In your example, you're calling the procedure with all small letters in insortexp:
    user13258760 wrote:
    SQL> exec trnsportitems.gettrnsportitems(1,10,'itemnumber desc', :n, :c);but the output is coming in ASC ending order:
    ...                           ORDER BY
                                     DECODE (insortexp, 'itemnumber ASC', item) ASC,
                                     DECODE (insortexp, 'itemnumber DESC', item) DESC,     -- capital 'DESC' won't match small 'desc'
                                     DECODE (insortexp, 'idescr ASC', idescr) ASC,
                                     DECODE (insortexp, 'idescr DESC', idescr) DESC,
                                     DECODE (insortexp, 'idescrl ASC', idescrl) ASC,
                                     DECODE (insortexp, 'idescrl DESC', idescrl) DESC,
                                     DECODE (insortexp, 'iunits ASC', iunits) ASC,
                                     DECODE (insortexp, 'iunits DESC', iunits) DESC,
                                     DECODE (insortexp, 'ispecyr ASC', ispecyr) ASC,
                                     DECODE (insortexp, 'ispecyr DESC', ispecyr) DESc,
                                   SUBSTR (item, 1, 4) || '.' || SUBSTR (item, 5)          -- This is the only non-NULL ORDER BY expression     Why not declare a local variable:
    sortexp      VARCHAR2 (20) := LOWER (insortexp);and use that variable instead of the raw argument in the query:
    ...                              DECODE (sortexp, 'itemnumber asc',  item) ASC,
                                     DECODE (sortexp, 'itemnumber desc', item) DESC, ...Also, this site doesn't like to display the &lt;&gt; operator, even inside \ tags.  When posting here, always use the other inequality operator, !=
    Edited by: Frank Kulash on Jun 15, 2010 3:25 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Please help me to increase the performance of the query

    Hello
    I am not an oracle expert or developer and i have a problem to resolve.
    Below is the query and explaiation plan and seeking the help to improve the performance of the query.
    Our Analysis,
    The query runs good,takes less one minute and fetches the results but during peak time it takes 8 minutes
    Require anyone suggestion's to improve the query.
    The query is generated from the Microsft dll so we dont have SQL code and require some help on tuning the tables.
    If tuning the query improves then also fine please suggest for that also.
    Enviroment: Solaris 8
    DB : oracle 9i
    (SELECT vw.dispapptobjid, vw.custsiteobjid, vw.emplastname, vw.empfirstname,
    vw.scheduledonsite AS starttime, vw.appttype, vw.latestart,
    vw.endtime, vw.typetitle, vw.empobjid, vw.latitude, vw.longitude,
    vw.workduration AS DURATION, vw.dispatchtype, vw.availability
    FROM ora_appt_disp_view vw
    WHERE ( ( vw.starttime >=
    TO_DATE ('2/12/2007 4:59 PM', 'MM/DD/YYYY HH12:MI AM')
    AND vw.starttime <
    TO_DATE ('2/21/2007 3:59 PM', 'MM/DD/YYYY HH12:MI AM')
    OR vw.endtime >
    TO_DATE ('2/12/2007 4:59 PM', 'MM/DD/YYYY HH12:MI AM')
    AND vw.endtime <=
    TO_DATE ('2/21/2007 3:59 PM', 'MM/DD/YYYY HH12:MI AM')
    OR ( vw.starttime <=
    TO_DATE ('2/12/2007 4:59 PM', 'MM/DD/YYYY HH12:MI AM')
    AND vw.endtime >=
    TO_DATE ('2/21/2007 3:59 PM', 'MM/DD/YYYY HH12:MI AM')
    UNION
    (SELECT 0 AS dispapptobjid, emp.emp_physical_site2site AS custsiteobjid,
    emp.last_name AS emplastname, emp.first_name AS empfirstname,
    TO_DATE ('1/1/3000', 'MM/DD/YYYY') AS starttime, 'E' AS appttype,
    NULL AS latestart, NULL AS endtime, '' AS typetitle,
    emp.objid AS empobjid, 0 AS latitude, 0 AS longitude, 0 AS DURATION,
    '' AS dispatchtype, 0 AS availability
    FROM table_employee emp, table_user usr
    WHERE emp.employee2user = usr.objid AND emp.field_eng = 1 AND usr.status = 1)
    ORDER BY empobjid, starttime, endtime DESC
    Operation     Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
    SELECT STATEMENT Optimizer Mode=HINT: ALL_ROWS          23 K          11312                     
    SORT UNIQUE          23 K     3 M     11140                     
    UNION-ALL                                        
    VIEW     ORA_APPT_DISP_VIEW     17 K     3 M     10485                     
    UNION-ALL                                        
    CONCATENATION                                        
    NESTED LOOPS OUTER          68      24 K     437                     
    NESTED LOOPS          68      23 K     369                     
    NESTED LOOPS OUTER          68      25 K     505                     
    NESTED LOOPS OUTER          68      24 K     505                     
    NESTED LOOPS          68      23 K     369                     
    NESTED LOOPS          68      22 K     369                     
    NESTED LOOPS OUTER          68      22 K     369                     
    NESTED LOOPS          19      6 K     312                     
    NESTED LOOPS          19      5 K     312                     
    HASH JOIN          19      5 K     293                     
    NESTED LOOPS          19      5 K     274                     
    NESTED LOOPS          19      4 K     236                     
    NESTED LOOPS          19      4 K     198                     
    NESTED LOOPS OUTER          19      3 K     160                     
    NESTED LOOPS OUTER          19      3 K     160                     
    NESTED LOOPS OUTER          19      4 K     160                     
    NESTED LOOPS OUTER          19      1 K     103                     
    NESTED LOOPS OUTER          19      2 K     103                     
    NESTED LOOPS OUTER          19      2 K     103                     
    TABLE ACCESS BY INDEX ROWID     TABLE_DISPTCHFE     19      1 K     46                     
    INDEX RANGE SCAN     GSA_SCHED_REPAIR     44           3                     
    TABLE ACCESS BY INDEX ROWID     TABLE_COMMIT_LOG     1      22                          
    INDEX RANGE SCAN     GSA_COMDFE     1           2                     
    TABLE ACCESS BY INDEX ROWID     TABLE_COMMIT_LOG     1      22                          
    INDEX RANGE SCAN     GSA_COMDFE     1           2                     
    TABLE ACCESS BY INDEX ROWID     TABLE_COMMIT_LOG     1      22      3                     
    INDEX RANGE SCAN     GSA_COMDFE     1           2                     
    TABLE ACCESS BY INDEX ROWID     TABLE_COMMIT_LOG     1      28                          
    INDEX RANGE SCAN     IND_CASE_COMMIT2CASE     2           2                     
    TABLE ACCESS BY INDEX ROWID     TABLE_COMMIT_LOG     1      28                          
    INDEX RANGE SCAN     IND_CASE_COMMIT2CASE     2           2                     
    TABLE ACCESS BY INDEX ROWID     TABLE_COMMIT_LOG     1      28      3                     
    INDEX RANGE SCAN     IND_CASE_COMMIT2CASE     2           2                     
    TABLE ACCESS BY INDEX ROWID     TABLE_CASE     1      30      2                     
    INDEX UNIQUE SCAN     CASE_OBJINDEX     1           1                     
    TABLE ACCESS BY INDEX ROWID     TABLE_SITE     1      12      2                     
    INDEX UNIQUE SCAN     SITE_OBJINDEX     1           1                     
    TABLE ACCESS BY INDEX ROWID     TABLE_ADDRESS     1      12      2                     
    INDEX UNIQUE SCAN     ADDRESS_OBJINDEX     1           1                     
    TABLE ACCESS FULL     TABLE_EMPLOYEE     1      34      1                     
    INDEX UNIQUE SCAN     SITE_OBJINDEX     1      6      1                     
    INDEX UNIQUE SCAN     USER_OBJINDEX     1      6                          
    TABLE ACCESS BY INDEX ROWID     TABLE_X_GSA_TIME_STAMPS     4      48      3                     
    INDEX RANGE SCAN     GSAIDX_TS2DISP     1           2                     
    INDEX UNIQUE SCAN     GBST_ELM_OBJINDEX     1      6                          
    INDEX UNIQUE SCAN     GBST_ELM_OBJINDEX     1      6                          
    TABLE ACCESS BY INDEX ROWID     TABLE_MOD_LEVEL     1      12      1                     
    INDEX UNIQUE SCAN     MOD_LEVEL_OBJINDEX     1                               
    INDEX UNIQUE SCAN     PART_NUM_OBJINDEX     1      6                          
    INDEX UNIQUE SCAN     GBST_ELM_OBJINDEX     1      6                          
    INDEX UNIQUE SCAN     SUBCASE_OBJINDX     1      6      1                     
    NESTED LOOPS OUTER          68      25 K     505                     
    NESTED LOOPS OUTER          68      24 K     505                     
    NESTED LOOPS OUTER          68      24 K     437                     
    NESTED LOOPS          68      23 K     369                     
    NESTED LOOPS          68      23 K     369                     
    NESTED LOOPS          68      22 K     369                     
    NESTED LOOPS OUTER          68      22 K     369                     
    NESTED LOOPS          19      6 K     312                     
    NESTED LOOPS          19      5 K     312                     
    NESTED LOOPS          19      5 K     293                     
    NESTED LOOPS          19      5 K     274                     
    NESTED LOOPS          19      4 K     236                     
    NESTED LOOPS          19      4 K     198                     
    NESTED LOOPS OUTER          19      4 K     160                     
    NESTED LOOPS OUTER          19      3 K     160                     
    NESTED LOOPS OUTER          19      3 K     160                     
    NESTED LOOPS OUTER          19      2 K     103                     
    NESTED LOOPS OUTER          19      2 K     103                     
    NESTED LOOPS OUTER          19      1 K     103                     
    TABLE ACCESS BY INDEX ROWID     TABLE_DISPTCHFE     19      1 K     46                     
    INDEX RANGE SCAN     GSA_SCHED_REPAIR     44           3                     
    TABLE ACCESS BY INDEX ROWID     TABLE_COMMIT_LOG     1      22      3                     
    INDEX RANGE SCAN     GSA_COMDFE     1           2                     
    TABLE ACCESS BY INDEX ROWID     TABLE_COMMIT_LOG     1      22                          
    INDEX RANGE SCAN     GSA_COMDFE     1           2                     
    TABLE ACCESS BY INDEX ROWID     TABLE_COMMIT_LOG     1      22                          
    INDEX RANGE SCAN     GSA_COMDFE     1           2                     
    TABLE ACCESS BY INDEX ROWID     TABLE_COMMIT_LOG     1      28      3                     
    INDEX RANGE SCAN     IND_CASE_COMMIT2CASE     2           2                     
    TABLE ACCESS BY INDEX ROWID     TABLE_COMMIT_LOG     1      28                          
    INDEX RANGE SCAN     IND_CASE_COMMIT2CASE     2           2                     
    TABLE ACCESS BY INDEX ROWID     TABLE_COMMIT_LOG     1      28                          
    INDEX RANGE SCAN     IND_CASE_COMMIT2CASE     2           2                     
    TABLE ACCESS BY INDEX ROWID     TABLE_CASE     1      30      2                     
    INDEX UNIQUE SCAN     CASE_OBJINDEX     1           1                     
    TABLE ACCESS BY INDEX ROWID     TABLE_SITE     1      12      2                     
    INDEX UNIQUE SCAN     SITE_OBJINDEX     1           1                     
    TABLE ACCESS BY INDEX ROWID     TABLE_ADDRESS     1      12      2                     
    INDEX UNIQUE SCAN     ADDRESS_OBJINDEX     1           1                     
    TABLE ACCESS BY INDEX ROWID     TABLE_EMPLOYEE     1      34      1                     
    INDEX UNIQUE SCAN     EMPLOYEE_OBJINDEX     1                               
    INDEX UNIQUE SCAN     SITE_OBJINDEX     1      6      1                     
    INDEX UNIQUE SCAN     USER_OBJINDEX     1      6                          
    TABLE ACCESS BY INDEX ROWID     TABLE_X_GSA_TIME_STAMPS     4      48      3                     
    INDEX RANGE SCAN     GSAIDX_TS2DISP     1           2                     
    INDEX UNIQUE SCAN     GBST_ELM_OBJINDEX     1      6                          
    INDEX UNIQUE SCAN     GBST_ELM_OBJINDEX     1      6                          
    INDEX UNIQUE SCAN     GBST_ELM_OBJINDEX     1      6                          
    INDEX UNIQUE SCAN     SUBCASE_OBJINDX     1      6      1                     
    TABLE ACCESS BY INDEX ROWID     TABLE_MOD_LEVEL     1      12      1                     
    INDEX UNIQUE SCAN     MOD_LEVEL_OBJINDEX     1                               
    INDEX UNIQUE SCAN     PART_NUM_OBJINDEX     1      6                          
    NESTED LOOPS OUTER          68      25 K     505                     
    NESTED LOOPS OUTER          68      24 K     505                     
    NESTED LOOPS OUTER          68      24 K     437                     
    NESTED LOOPS          68      23 K     369                     
    NESTED LOOPS          68      23 K     369                     
    NESTED LOOPS          68      22 K     369                     
    NESTED LOOPS OUTER          68      22 K     369                     
    NESTED LOOPS          19      6 K     312                     
    NESTED LOOPS          19      5 K     312                     
    NESTED LOOPS          19      5 K     293                     
    NESTED LOOPS          19      5 K     274                     
    NESTED LOOPS          19      4 K     236                     
    NESTED LOOPS          19      4 K     198                     
    NESTED LOOPS OUTER          19      4 K     160                     
    NESTED LOOPS OUTER          19      3 K     160                     
    NESTED LOOPS OUTER          19      3 K     160                     
    NESTED LOOPS OUTER          19      2 K     103                     
    NESTED LOOPS OUTER          19      2 K     103                     
    NESTED LOOPS OUTER          19      1 K     103                     
    TABLE ACCESS BY INDEX ROWID     TABLE_DISPTCHFE     19      1 K     46                     
    INDEX RANGE SCAN     GSA_REQ_ETA     44           3                     
    TABLE ACCESS BY INDEX ROWID     TABLE_COMMIT_LOG     1      22      3                     
    INDEX RANGE SCAN     GSA_COMDFE     1           2                     
    TABLE ACCESS BY INDEX ROWID     TABLE_COMMIT_LOG     1      22                          
    INDEX RANGE SCAN     GSA_COMDFE     1           2                     
    TABLE ACCESS BY INDEX ROWID     TABLE_COMMIT_LOG     1      22                          
    INDEX RANGE SCAN     GSA_COMDFE     1           2                     
    TABLE ACCESS BY INDEX ROWID     TABLE_COMMIT_LOG     1      28      3                     
    INDEX RANGE SCAN     IND_CASE_COMMIT2CASE     2           2                     
    TABLE ACCESS BY INDEX ROWID     TABLE_COMMIT_LOG     1      28                          
    INDEX RANGE SCAN     IND_CASE_COMMIT2CASE     2           2                     
    TABLE ACCESS BY INDEX ROWID     TABLE_COMMIT_LOG     1      28                          
    INDEX RANGE SCAN     IND_CASE_COMMIT2CASE     2           2                     
    TABLE ACCESS BY INDEX ROWID     TABLE_CASE     1      30      2                     
    INDEX UNIQUE SCAN     CASE_OBJINDEX     1           1                     
    TABLE ACCESS BY INDEX ROWID     TABLE_SITE     1      12      2                     
    INDEX UNIQUE SCAN     SITE_OBJINDEX     1           1                     
    TABLE ACCESS BY INDEX ROWID     TABLE_ADDRESS     1      12      2                     
    INDEX UNIQUE SCAN     ADDRESS_OBJINDEX     1           1                     
    TABLE ACCESS BY INDEX ROWID     TABLE_EMPLOYEE     1      34      1                     
    INDEX UNIQUE SCAN     EMPLOYEE_OBJINDEX     1                               
    INDEX UNIQUE SCAN     SITE_OBJINDEX     1      6      1                     
    INDEX UNIQUE SCAN     USER_OBJINDEX     1      6                          
    TABLE ACCESS BY INDEX ROWID     TABLE_X_GSA_TIME_STAMPS     4      48      3                     
    INDEX RANGE SCAN     GSAIDX_TS2DISP     1           2                     
    INDEX UNIQUE SCAN     GBST_ELM_OBJINDEX     1      6                          
    INDEX UNIQUE SCAN     GBST_ELM_OBJINDEX     1      6                          
    INDEX UNIQUE SCAN     GBST_ELM_OBJINDEX     1      6                          
    INDEX UNIQUE SCAN     SUBCASE_OBJINDX     1      6      1                     
    TABLE ACCESS BY INDEX ROWID     TABLE_MOD_LEVEL     1      12      1                     
    INDEX UNIQUE SCAN     MOD_LEVEL_OBJINDEX     1                               
    INDEX UNIQUE SCAN     PART_NUM_OBJINDEX     1      6                          
    NESTED LOOPS          16 K     2 M     5812                     
    HASH JOIN          16 K     2 M     5812                     
    HASH JOIN          16 K     2 M     5286                     
    TABLE ACCESS FULL     TABLE_EMPLOYEE     13 K     441 K     28                     
    HASH JOIN          16 K     1 M     5243                     
    TABLE ACCESS FULL     TABLE_SCHEDULE     991      11 K     2                     
    HASH JOIN OUTER          16 K     1 M     5240                     
    HASH JOIN OUTER          16 K     1 M     3866                     
    HASH JOIN OUTER          16 K     1 M     450                     
    HASH JOIN          16 K     1 M     44                     
    TABLE ACCESS FULL     TABLE_GBST_ELM     781      14 K     2                     
    TABLE ACCESS FULL     TABLE_APPOINTMENT     16 K     822 K     41                     
    INDEX FAST FULL SCAN     CASE_OBJINDEX     1 M     6 M     201                     
    TABLE ACCESS FULL     TABLE_SITE     967 K     11 M     3157                     
    TABLE ACCESS FULL     TABLE_ADDRESS     961 K     11 M     1081                     
    INDEX FAST FULL SCAN     SITE_OBJINDEX     967 K     5 M     221                     
    INDEX UNIQUE SCAN     USER_OBJINDEX     1      6                          
    HASH JOIN          6 K     272 K     51                     
    TABLE ACCESS FULL     TABLE_USER     6 K     51 K     21                     
    TABLE ACCESS FULL     TABLE_EMPLOYEE     6 K     220 K     28

    Hi,
    First-off, it appear that you are querying a view. I would redo the auery against the base table.
    Next, look at a function-based index for the DATE column. Here are my notes:
    http://www.dba-oracle.com/t_function_based_indexes.htm
    http://www.dba-oracle.com/oracle_tips_index_scan_fbi_sql.htm
    Also, make sure you are analyzed properly with dbms_stats:
    http://www.dba-oracle.com/art_builder_dbms_stats.htm
    And histograms, if appropriate:
    http://www.dba-oracle.com/art_builder_histo.htm
    Lasty, look at increasing hash_area_size or pga_aggregate_tagtet, depending on your table sizes:
    http://www.dba-oracle.com/art_so_undocumented_pga_parameters.htm
    Hope this helps. . . .
    Donald K. Burleson
    Oracle Press Author

  • Changing the query on a view object

    I have a view object right now, based on an entity. It is the default view object, so that means the query in the view object is straight forward, it grabs all of the attributes from the table. And there is no WHERE clause.
    In reality I only want to show a finite set of rows from my table. Every time a record is changed/edited in this entity and committed, a new row in the database is created with the same information (I'm using CreateWithParams) except for a few columns.
    I actually don't really have update on this table, just creation of new rows. But to the user, I want it to 'look' like they are editing something in the table.
    Example:
    12, 11:32,Thompson, 60 (the user edits this information in an adf table, and a new row is created in the db)
    12, 11:55, Thompson, 75
    I have a timestamp (see above) field in the database that is used as part of my primary key, so that I know which record is the latest.
    When the VO query is run, I want the user to only see the latest row from the db.
    12, 11:55, Thompson, 75
    So...
    I went to my VO, and I changed the WHERE query to add this:
    where t1.TimeStamp = (Select MAX(t2.TimeStamp) FROM rcl.x t2 where t1.uid = t2.uid);
    Now, this isn't a mysql/sql question. There's actually a better query that I'd rather run, but the VO editor doesn't allow me to change the query itself....
    When I save the new WHERE to my VO, run my page again, I get the expected result (showing me only the latest records).
    However, when I try and sort on the table in which my data is displayed, I am now getting ORDER BY errors.
    I don't want my VO to be read-only sql based. I want to be able to update my table, so I have my VO running off of the entity.
    Why doesn't the VO allow me to change the query itself? (Like do a subquery, instead of having my where clause do the work)
    Why are order by errors being thrown when I sort on my adf table after changing the where clause in my view?
    Hopefully I wasn't too convoluted in the explanation of my problem..
    Thanks in advance,
    Joel

    HI Joe,
    Regarding your problem you can do one of the following tasks:
    1- easily to tuning on your view object, I mean in the tuning page of the view you can set that only return 1 record or 2-3 record fetch not all the record.
    in the order by you will order by the timestamp field and descending.
    2- you can order by the timestamp descending and in the where clause only set the rownum<2 (will return the last record) you can also set rownum<5 and get the 4 last record etc.
    3-editing the view query in the expert mode is not advised at all because of many consequences that you will face.
    4- maybe it is not bat that you add a readonly view for the table you mentioned and every time you unpdate the entity just re-execute the read-only view.( this method maybe is good maybe is not it depends on your business logic)
    Regards.
    Edited by: Amir Khanof on Sep 3, 2010 11:11 PM

  • Getting Brain Error while saving the query--Need Immediate solution

    Hello Experte
    I designed query like this.
    G/L account structure is defined in Rows. Before explaining about columns Let me Explain u about my ORG structure.
    Company codes are defined in R/3 like this.
    Company Code
    1000 for Local Currency(HSL01)
    2000 to 7000,IEL for group Currency(KSL01).
    Iu2019m extracting the data as it is from R/3 to DSO and again by writing routine I splitter the data for months(EX: HSL01 is ApriL,Hsl02 May,u2026u2026u2026u2026u2026u2026.KSL01 April, KSL02 may,u2026u2026u2026. Upto to 16 periods) this is R/3 data. This data I differentiated based upon currency types. If currency type is 10 then Local Currency 30 Means Group Currency.
    Again Iu2019m receiving the data from Flat Files for subsidiaries(IEAI,IEG,IEEL,ISSCI,IHAL,TTM-US,TTM-INDIA,TTIT). This data I loaded first into DSO by writing Routine at field Level for G/L account to convert G/L Descriptions into Numbers.
    After that I loaded data from first DSO to Second DSO by writing to convert respective currencies into INR and again loaded to cube by Direct mapping.
    Again Iu2019m receiving the eliminations data from R/3 through Ztable. This also Iu2019m extracting from R/3  and loaded into dso and again into cube.
    Now I will Explain about my Report.
    In Columns I defined 3 selections for each month.  U can observe that in Document. Like that for each month Iu2019m getting three selections and for subsidiaries 2 selections for each month. If we observe total Iu2019m getting 13 selections for India and 9 selections for each subsidiary. If subsidiaries increase I need to increase selections, automatically columns will increase. Now for Q4 2 new subsidiaries are  added I need to added. After adding and while saving the query then only Iu2019m getting brain error.
    Could any one sort out this.
    Thanks,
    Sony

    HI Ravi,
    Thanks for the reply.
    While saving the query in BEX i'm getting this error.
    Diagnosis
    Query ZQ3_MISGRPSUMMARYREPORT_010209 contains 8192 differing selection cells. However, only 8191 selection cells can be processed in a query.
    Procedure
    Please simplify query definition ZQ3_MISGRPSUMMARYREPORT_010209.
    This was the error i'm getting. How to simplify this....
    Any answers please.
    Thanks,
    Sony

  • Result of the query is not filtered as value given in Select Option variabl

    Hello ,
    A Select option Variable is created on Navigational Attribute( ZINV_PROG) of 0WBS_ELEMT.
    The Compound Key for object ZINV_PROG(Investment program) is APPR_YEAR( Approval Year)
    This ZINV_PROG object does not bear Master data.
    The values in the field get populated as you load Master data of 0WBS_ELEMT.
    The values for this objects is as shown below:
    APPR_YEAR ZINVPROG
    2005 ESCCCAPS
    2007 ESCCCAPS
    2008 FIRE
    2006 CAPITAL
    A select option variable is craeted on this Navigational attribute.
    When you execute the query , On the selection screen of the query..
    If you provide i/p for Investment programm field as 2007 ESCCCAPS, the data should ideally be filtered for this values only.
    But the result of the query shows data for both values 2005 ESCCCAPS and as well as for 2007ESCCCAPS.
    Let me know how to sort this issue.
    Points will be assigned for the correct and helpfull answere.
    Thanks,

    Thanks Srini for your prompt explanation.
    My Question is if Approval year is a compounded key of ZINV_PROG object why data would not get filter out directly.
    I mean on the screen for this particualr variable i take help - F4 to see values there you are able to see all the values of Investment programm along with the apprroval year.
    If i select value as 2005 ESCCCAPS from the help F4 screen then ideally data should be fileterd out for this particular value. But it is not happening so.
    Is that so in Query desgining that if you creating a variable on Nav Attribute, and that particular Nav attribute has a compound key then if you want to filter out the data for this Nav attribute correctly you would also require to create a variable for Compound key also.
    Please let me know
    Thanks

  • Index not getting used in the query(Query performance improvement)

    Hi,
    I am using oracle 10g version and have this query:
    select distinct bk.name             "Book Name",
                    fs.feed_description "Feed Name",
                    fbs.cob_date        "Cob",
                    at.description      "Data Type",
                    ah.user_name        " User",
                    ah.comments         "Comments",
                    ah.time_draft
      from Action_type       at,
           action_history    ah,
           sensitivity_audit sa,
           logical_entity    le,
           feed_static       fs,
           feed_book_status  fbs,
           feed_instance     fi,
           marsnode          bk
    where at.description = 'Regress Positions'
       and fbs.cob_date BETWEEN '01 Feb 2011' AND '08 Feb 2011'
       and fi.most_recent = 'Y'
       and bk.close_date is null
       and ah.time_draft = 'after'
       and sa.close_action_id is null
       and le.close_action_id is null
       and at.action_type_id = ah.action_type_id
       and ah.action_id = sa.create_action_id
       and le.logical_entity_id = sa.type_id
       and sa.feed_id = fs.feed_id
       and sa.book_id = bk.node_id
       and sa.feed_instance_id = fi.feed_instance_id
       and fbs.feed_instance_id = fi.feed_instance_id
       and fi.feed_id = fs.feed_id
    union
    select distinct bk.name             "Book Name",
                    fs.feed_description "Feed Name",
                    fbs.cob_date        "Cob",
                    at.description      "Data Type",
                    ah.user_name        " User",
                    ah.comments         "Comments",
                    ah.time_draft
      from feed_book_status         fbs,
           marsnode                 bk,
           feed_instance            fi,
           feed_static              fs,
           feed_book_status_history fbsh,
           Action_type              at,
           Action_history           ah
    where fbs.cob_date BETWEEN '01 Feb 2011' AND '08 Feb 2011'
       and ah.action_type_id = 103
       and bk.close_date is null
       and ah.time_draft = 'after'
    --   and ah.action_id = fbs.action_id
       and fbs.book_id = bk.node_id
       and fbs.book_id = fbsh.book_id
       and fbs.feed_instance_id = fi.feed_instance_id
       and fi.feed_id = fs.feed_id
       and fbsh.create_action_id = ah.action_id
       and at.action_type_id = ah.action_type_id
    union
    select distinct bk.name             "Book Name",
                    fs.feed_description "Feed Name",
                    fbs.cob_date        "Cob",
                    at.description      "Data Type",
                    ah.user_name        " User",
                    ah.comments         "Comments",
                    ah.time_draft
      from feed_book_status         fbs,
           marsnode                 bk,
           feed_instance            fi,
           feed_static              fs,
           feed_book_status_history fbsh,
           Action_type              at,
           Action_history           ah
    where fbs.cob_date BETWEEN '01 Feb 2011' AND '08 Feb 2011'
       and ah.action_type_id = 101
       and bk.close_date is null
       and ah.time_draft = 'after'
       and fbs.book_id = bk.node_id
       and fbs.book_id = fbsh.book_id
       and fbs.feed_instance_id = fi.feed_instance_id
       and fi.feed_id = fs.feed_id
       and fbsh.create_action_id = ah.action_id
       and at.action_type_id = ah.action_type_id;This is the execution plan
    | Id  | Operation                            | Name                     | Rows  | Bytes | Cost (%CPU)|
    |   0 | SELECT STATEMENT                     |                          |   231 | 43267 |   104K (85)|
    |   1 |  SORT UNIQUE                         |                          |   231 | 43267 |   104K (85)|
    |   2 |   UNION-ALL                          |                          |       |       |            |
    |   3 |    NESTED LOOPS                      |                          |     1 |   257 | 19540  (17)|
    |   4 |     NESTED LOOPS                     |                          |     1 |   230 | 19539  (17)|
    |   5 |      NESTED LOOPS                    |                          |     1 |   193 | 19537  (17)|
    |   6 |       NESTED LOOPS                   |                          |     1 |   152 | 19534  (17)|
    |*  7 |        HASH JOIN                     |                          |   213 | 26625 | 19530  (17)|
    |*  8 |         TABLE ACCESS FULL            | LOGICAL_ENTITY           |    12 |   264 |     2   (0)|
    |*  9 |         HASH JOIN                    |                          |  4267 |   429K| 19527  (17)|
    |* 10 |          HASH JOIN                   |                          |  3602 | 90050 |  1268  (28)|
    |* 11 |           INDEX RANGE SCAN           | IDX_FBS_CD_FII_BI        |  3602 | 46826 |    22   (5)|
    |* 12 |           TABLE ACCESS FULL          | FEED_INSTANCE            |   335K|  3927K|  1217  (27)|
    |* 13 |          TABLE ACCESS FULL           | SENSITIVITY_AUDIT        |   263K|    19M| 18236  (17)|
    |  14 |        TABLE ACCESS BY INDEX ROWID   | FEED_STATIC              |     1 |    27 |     1   (0)|
    |* 15 |         INDEX UNIQUE SCAN            | IDX_FEED_STATIC_FI       |     1 |       |     0   (0)|
    |* 16 |       TABLE ACCESS BY INDEX ROWID    | MARSNODE                 |     1 |    41 |     3   (0)|
    |* 17 |        INDEX RANGE SCAN              | PK_MARSNODE              |     3 |       |     2   (0)|
    |* 18 |      TABLE ACCESS BY INDEX ROWID     | ACTION_HISTORY           |     1 |    37 |     2   (0)|
    |* 19 |       INDEX UNIQUE SCAN              | PK_ACTION_HISTORY        |     1 |       |     1   (0)|
    |* 20 |     TABLE ACCESS BY INDEX ROWID      | ACTION_TYPE              |     1 |    27 |     1   (0)|
    |* 21 |      INDEX UNIQUE SCAN               | PK_ACTION_TYPE           |     1 |       |     0   (0)|
    |* 22 |    TABLE ACCESS BY INDEX ROWID       | MARSNODE                 |     1 |    41 |     3   (0)|
    |  23 |     NESTED LOOPS                     |                          |   115 | 21505 | 42367  (28)|
    |* 24 |      HASH JOIN                       |                          |   114 | 16644 | 42023  (28)|
    |  25 |       NESTED LOOPS                   |                          |   114 | 13566 | 42007  (28)|
    |* 26 |        HASH JOIN                     |                          |   114 | 12426 | 41777  (28)|
    |* 27 |         HASH JOIN                    |                          |   957 | 83259 | 41754  (28)|
    |* 28 |          TABLE ACCESS FULL           | ACTION_HISTORY           |  2480 | 91760 | 30731  (28)|
    |  29 |          NESTED LOOPS                |                          |  9570K|   456M| 10234  (21)|
    |  30 |           TABLE ACCESS BY INDEX ROWID| ACTION_TYPE              |     1 |    27 |     1   (0)|
    |* 31 |            INDEX UNIQUE SCAN         | PK_ACTION_TYPE           |     1 |       |     0   (0)|
    |  32 |           TABLE ACCESS FULL          | FEED_BOOK_STATUS_HISTORY |  9570K|   209M| 10233  (21)|
    |* 33 |         INDEX RANGE SCAN             | IDX_FBS_CD_FII_BI        |  3602 | 79244 |    22   (5)|
    |  34 |        TABLE ACCESS BY INDEX ROWID   | FEED_INSTANCE            |     1 |    10 |     2   (0)|
    |* 35 |         INDEX UNIQUE SCAN            | PK_FEED_INSTANCE         |     1 |       |     1   (0)|
    |  36 |       TABLE ACCESS FULL              | FEED_STATIC              |  2899 | 78273 |    16   (7)|
    |* 37 |      INDEX RANGE SCAN                | PK_MARSNODE              |     1 |       |     2   (0)|
    |* 38 |    TABLE ACCESS BY INDEX ROWID       | MARSNODE                 |     1 |    41 |     3   (0)|
    |  39 |     NESTED LOOPS                     |                          |   115 | 21505 | 42367  (28)|
    |* 40 |      HASH JOIN                       |                          |   114 | 16644 | 42023  (28)|
    |  41 |       NESTED LOOPS                   |                          |   114 | 13566 | 42007  (28)|
    |* 42 |        HASH JOIN                     |                          |   114 | 12426 | 41777  (28)|
    |* 43 |         HASH JOIN                    |                          |   957 | 83259 | 41754  (28)|
    |* 44 |          TABLE ACCESS FULL           | ACTION_HISTORY           |  2480 | 91760 | 30731  (28)|
    |  45 |          NESTED LOOPS                |                          |  9570K|   456M| 10234  (21)|
    |  46 |           TABLE ACCESS BY INDEX ROWID| ACTION_TYPE              |     1 |    27 |     1   (0)|
    |* 47 |            INDEX UNIQUE SCAN         | PK_ACTION_TYPE           |     1 |       |     0   (0)|
    |  48 |           TABLE ACCESS FULL          | FEED_BOOK_STATUS_HISTORY |  9570K|   209M| 10233  (21)|
    |* 49 |         INDEX RANGE SCAN             | IDX_FBS_CD_FII_BI        |  3602 | 79244 |    22   (5)|
    |  50 |        TABLE ACCESS BY INDEX ROWID   | FEED_INSTANCE            |     1 |    10 |     2   (0)|
    |* 51 |         INDEX UNIQUE SCAN            | PK_FEED_INSTANCE         |     1 |       |     1   (0)|
    |  52 |       TABLE ACCESS FULL              | FEED_STATIC              |  2899 | 78273 |    16   (7)|
    |* 53 |      INDEX RANGE SCAN                | PK_MARSNODE              |     1 |       |     2   (0)|
    ------------------------------------------------------------------------------------------------------and the predicate info
    Predicate Information (identified by operation id):
       7 - access("LE"."LOGICAL_ENTITY_ID"="SA"."TYPE_ID")
       8 - filter("LE"."CLOSE_ACTION_ID" IS NULL)
       9 - access("SA"."FEED_INSTANCE_ID"="FI"."FEED_INSTANCE_ID")
      10 - access("FBS"."FEED_INSTANCE_ID"="FI"."FEED_INSTANCE_ID")
      11 - access("FBS"."COB_DATE">=TO_DATE(' 2011-02-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
                  "FBS"."COB_DATE"<=TO_DATE(' 2011-02-08 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
      12 - filter("FI"."MOST_RECENT"='Y')
      13 - filter("SA"."CLOSE_ACTION_ID" IS NULL)
      15 - access("FI"."FEED_ID"="FS"."FEED_ID")
           filter("SA"."FEED_ID"="FS"."FEED_ID")
      16 - filter("BK"."CLOSE_DATE" IS NULL)
      17 - access("SA"."BOOK_ID"="BK"."NODE_ID")
      18 - filter("AH"."TIME_DRAFT"='after')
      19 - access("AH"."ACTION_ID"="SA"."CREATE_ACTION_ID")
      20 - filter("AT"."DESCRIPTION"='Regress Positions')
      21 - access("AT"."ACTION_TYPE_ID"="AH"."ACTION_TYPE_ID")
      22 - filter("BK"."CLOSE_DATE" IS NULL)
      24 - access("FI"."FEED_ID"="FS"."FEED_ID")
      26 - access("FBS"."BOOK_ID"="FBSH"."BOOK_ID")
      27 - access("FBSH"."CREATE_ACTION_ID"="AH"."ACTION_ID" AND
                  "AT"."ACTION_TYPE_ID"="AH"."ACTION_TYPE_ID")
      28 - filter("AH"."ACTION_TYPE_ID"=103 AND "AH"."TIME_DRAFT"='after')
      31 - access("AT"."ACTION_TYPE_ID"=103)
      33 - access("FBS"."COB_DATE">=TO_DATE(' 2011-02-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
                  "FBS"."COB_DATE"<=TO_DATE(' 2011-02-08 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
      35 - access("FBS"."FEED_INSTANCE_ID"="FI"."FEED_INSTANCE_ID")
      37 - access("FBS"."BOOK_ID"="BK"."NODE_ID")
      38 - filter("BK"."CLOSE_DATE" IS NULL)
      40 - access("FI"."FEED_ID"="FS"."FEED_ID")
      42 - access("FBS"."BOOK_ID"="FBSH"."BOOK_ID")
      43 - access("FBSH"."CREATE_ACTION_ID"="AH"."ACTION_ID" AND
                  "AT"."ACTION_TYPE_ID"="AH"."ACTION_TYPE_ID")
      44 - filter("AH"."ACTION_TYPE_ID"=101 AND "AH"."TIME_DRAFT"='after')
      47 - access("AT"."ACTION_TYPE_ID"=101)
      49 - access("FBS"."COB_DATE">=TO_DATE(' 2011-02-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
                  "FBS"."COB_DATE"<=TO_DATE(' 2011-02-08 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
      51 - access("FBS"."FEED_INSTANCE_ID"="FI"."FEED_INSTANCE_ID")
      53 - access("FBS"."BOOK_ID"="BK"."NODE_ID")
    Note
       - 'PLAN_TABLE' is old versionIn this query, mainly the ACTION_HISTORY and FEED_BOOK_STATUS_HISTORY tables are getting accessed fullly though there are indexes createdon them like this
    ACTION_HISTORY
    ACTION_ID  column Unique index
    FEED_BOOK_STATUS_HISTORY
    (FEED_INSTANCE_ID, BOOK_ID, COB_DATE, VERSION) composite indexI tried all the best combinations however the indexes are not getting used anywhere.
    Could you please suggest some way so the query will perform better way.
    Thanks,
    Aashish

    Hi Mohammed,
    This is what I got after your method of execution plan
    SQL_ID  4vmc8rzgaqgka, child number 0
    select distinct bk.name "Book Name" ,       fs.feed_description "Feed Name" ,       fbs.cob_date
    "Cob" ,       at.description "Data Type" ,       ah.user_name " User" ,       ah.comments "Comments"
    ,       ah.time_draft from Action_type at, action_history  ah, sensitivity_audit sa, logical_entity
    le, feed_static fs, feed_book_status fbs, feed_instance fi, marsnode bk where  at.description =
    'Regress Positions' and    fbs.cob_date BETWEEN '01 Feb 2011' AND '08 Feb 2011' and
    fi.most_recent = 'Y' and    bk.close_date is  null and    ah.time_draft='after' and
    sa.close_action_id is null and    le.close_action_id is null and    at.action_type_id =
    ah.action_type_id and    ah.action_id=sa.create_action_id and    le.logical_entity_id = sa.type_id
    and    sa.feed_id = fs.feed_id and    sa.book_id = bk.node_id and    sa.feed_instance_id =
    fi.feed_instance_id and    fbs.feed_instance_id = fi.feed_instance_id and    fi.feed_id = fs.feed_id
    union select distinct bk.name "Book Name" ,       fs.
    Plan hash value: 1006571916
    | Id  | Operation                            | Name                     | E-Rows |  OMem |  1Mem | Used-Mem |
    |   1 |  SORT UNIQUE                         |                          |    231 |  6144 |  6144 | 6144  (0)|
    |   2 |   UNION-ALL                          |                          |        |       |       |          |
    |   3 |    NESTED LOOPS                      |                          |      1 |       |       |          |
    |   4 |     NESTED LOOPS                     |                          |      1 |       |       |          |
    |   5 |      NESTED LOOPS                    |                          |      1 |       |       |          |
    |   6 |       NESTED LOOPS                   |                          |      1 |       |       |          |
    |*  7 |        HASH JOIN                     |                          |    213 |  1236K|  1236K| 1201K (0)|
    |*  8 |         TABLE ACCESS FULL            | LOGICAL_ENTITY           |     12 |       |       |          |
    |*  9 |         HASH JOIN                    |                          |   4267 |  1023K|  1023K| 1274K (0)|
    |* 10 |          HASH JOIN                   |                          |   3602 |  1095K|  1095K| 1296K (0)|
    |* 11 |           INDEX RANGE SCAN           | IDX_FBS_CD_FII_BI        |   3602 |       |       |          |
    |* 12 |           TABLE ACCESS FULL          | FEED_INSTANCE            |    335K|       |       |          |
    |* 13 |          TABLE ACCESS FULL           | SENSITIVITY_AUDIT        |    263K|       |       |          |
    |  14 |        TABLE ACCESS BY INDEX ROWID   | FEED_STATIC              |      1 |       |       |          |
    |* 15 |         INDEX UNIQUE SCAN            | IDX_FEED_STATIC_FI       |      1 |       |       |          |
    |* 16 |       TABLE ACCESS BY INDEX ROWID    | MARSNODE                 |      1 |       |       |          |
    |* 17 |        INDEX RANGE SCAN              | PK_MARSNODE              |      3 |       |       |          |
    |* 18 |      TABLE ACCESS BY INDEX ROWID     | ACTION_HISTORY           |      1 |       |       |          |
    |* 19 |       INDEX UNIQUE SCAN              | PK_ACTION_HISTORY        |      1 |       |       |          |
    |* 20 |     TABLE ACCESS BY INDEX ROWID      | ACTION_TYPE              |      1 |       |       |          |
    |* 21 |      INDEX UNIQUE SCAN               | PK_ACTION_TYPE           |      1 |       |       |          |
    |* 22 |    TABLE ACCESS BY INDEX ROWID       | MARSNODE                 |      1 |       |       |          |
    |  23 |     NESTED LOOPS                     |                          |    115 |       |       |          |
    |* 24 |      HASH JOIN                       |                          |    114 |   809K|   809K|  817K (0)|
    |  25 |       NESTED LOOPS                   |                          |    114 |       |       |          |
    |* 26 |        HASH JOIN                     |                          |    114 |   868K|   868K| 1234K (0)|
    |* 27 |         HASH JOIN                    |                          |    957 |   933K|   933K| 1232K (0)|
    |* 28 |          TABLE ACCESS FULL           | ACTION_HISTORY           |   2480 |       |       |          |
    |  29 |          NESTED LOOPS                |                          |   9570K|       |       |          |
    |  30 |           TABLE ACCESS BY INDEX ROWID| ACTION_TYPE              |      1 |       |       |          |
    |* 31 |            INDEX UNIQUE SCAN         | PK_ACTION_TYPE           |      1 |       |       |          |
    |  32 |           TABLE ACCESS FULL          | FEED_BOOK_STATUS_HISTORY |   9570K|       |       |          |
    |* 33 |         INDEX RANGE SCAN             | IDX_FBS_CD_FII_BI        |   3602 |       |       |          |
    |  34 |        TABLE ACCESS BY INDEX ROWID   | FEED_INSTANCE            |      1 |       |       |          |
    |* 35 |         INDEX UNIQUE SCAN            | PK_FEED_INSTANCE         |      1 |       |       |          |
    |  36 |       TABLE ACCESS FULL              | FEED_STATIC              |   2899 |       |       |          |
    |* 37 |      INDEX RANGE SCAN                | PK_MARSNODE              |      1 |       |       |          |
    |* 38 |    TABLE ACCESS BY INDEX ROWID       | MARSNODE                 |      1 |       |       |          |
    |  39 |     NESTED LOOPS                     |                          |    115 |       |       |          |
    |* 40 |      HASH JOIN                       |                          |    114 |   743K|   743K|  149K (0)|
    |  41 |       NESTED LOOPS                   |                          |    114 |       |       |          |
    |* 42 |        HASH JOIN                     |                          |    114 |   766K|   766K|  208K (0)|
    |* 43 |         HASH JOIN                    |                          |    957 |   842K|   842K|  204K (0)|
    |* 44 |          TABLE ACCESS FULL           | ACTION_HISTORY           |   2480 |       |       |          |
    |  45 |          NESTED LOOPS                |                          |   9570K|       |       |          |
    |  46 |           TABLE ACCESS BY INDEX ROWID| ACTION_TYPE              |      1 |       |       |          |
    |* 47 |            INDEX UNIQUE SCAN         | PK_ACTION_TYPE           |      1 |       |       |          |
    |  48 |           TABLE ACCESS FULL          | FEED_BOOK_STATUS_HISTORY |   9570K|       |       |          |
    |* 49 |         INDEX RANGE SCAN             | IDX_FBS_CD_FII_BI        |   3602 |       |       |          |
    |  50 |        TABLE ACCESS BY INDEX ROWID   | FEED_INSTANCE            |      1 |       |       |          |
    |* 51 |         INDEX UNIQUE SCAN            | PK_FEED_INSTANCE         |      1 |       |       |          |
    |  52 |       TABLE ACCESS FULL              | FEED_STATIC              |   2899 |       |       |          |
    |* 53 |      INDEX RANGE SCAN                | PK_MARSNODE              |      1 |       |       |          |
    Predicate Information (identified by operation id):
       7 - access("LE"."LOGICAL_ENTITY_ID"="SA"."TYPE_ID")
       8 - filter("LE"."CLOSE_ACTION_ID" IS NULL)
       9 - access("SA"."FEED_INSTANCE_ID"="FI"."FEED_INSTANCE_ID")
      10 - access("FBS"."FEED_INSTANCE_ID"="FI"."FEED_INSTANCE_ID")
      11 - access("FBS"."COB_DATE">=TO_DATE(' 2011-02-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
                  "FBS"."COB_DATE"<=TO_DATE(' 2011-02-08 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
      12 - filter("FI"."MOST_RECENT"='Y')
      13 - filter("SA"."CLOSE_ACTION_ID" IS NULL)
      15 - access("FI"."FEED_ID"="FS"."FEED_ID")
           filter("SA"."FEED_ID"="FS"."FEED_ID")
      16 - filter("BK"."CLOSE_DATE" IS NULL)
      17 - access("SA"."BOOK_ID"="BK"."NODE_ID")
      18 - filter("AH"."TIME_DRAFT"='after')
      19 - access("AH"."ACTION_ID"="SA"."CREATE_ACTION_ID")
      20 - filter("AT"."DESCRIPTION"='Regress Positions')
      21 - access("AT"."ACTION_TYPE_ID"="AH"."ACTION_TYPE_ID")
      22 - filter("BK"."CLOSE_DATE" IS NULL)
      24 - access("FI"."FEED_ID"="FS"."FEED_ID")
      26 - access("FBS"."BOOK_ID"="FBSH"."BOOK_ID")
      27 - access("FBSH"."CREATE_ACTION_ID"="AH"."ACTION_ID" AND
                  "AT"."ACTION_TYPE_ID"="AH"."ACTION_TYPE_ID")
      28 - filter(("AH"."ACTION_TYPE_ID"=103 AND "AH"."TIME_DRAFT"='after'))
      31 - access("AT"."ACTION_TYPE_ID"=103)
      33 - access("FBS"."COB_DATE">=TO_DATE(' 2011-02-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
                  "FBS"."COB_DATE"<=TO_DATE(' 2011-02-08 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
      35 - access("FBS"."FEED_INSTANCE_ID"="FI"."FEED_INSTANCE_ID")
      37 - access("FBS"."BOOK_ID"="BK"."NODE_ID")
      38 - filter("BK"."CLOSE_DATE" IS NULL)
      40 - access("FI"."FEED_ID"="FS"."FEED_ID")
      42 - access("FBS"."BOOK_ID"="FBSH"."BOOK_ID")
      43 - access("FBSH"."CREATE_ACTION_ID"="AH"."ACTION_ID" AND
                  "AT"."ACTION_TYPE_ID"="AH"."ACTION_TYPE_ID")
      44 - filter(("AH"."ACTION_TYPE_ID"=101 AND "AH"."TIME_DRAFT"='after'))
      47 - access("AT"."ACTION_TYPE_ID"=101)
      49 - access("FBS"."COB_DATE">=TO_DATE(' 2011-02-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
                  "FBS"."COB_DATE"<=TO_DATE(' 2011-02-08 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
      51 - access("FBS"."FEED_INSTANCE_ID"="FI"."FEED_INSTANCE_ID")
      53 - access("FBS"."BOOK_ID"="BK"."NODE_ID")
    Note
       - Warning: basic plan statistics not available. These are only collected when:
           * hint 'gather_plan_statistics' is used for the statement or
           * parameter 'statistics_level' is set to 'ALL', at session or system level
    122 rows selected.
    Elapsed: 00:00:02.18The action_type_id column is of NUMBER type.

  • Can users see the query plan of a SQL query in Oracle?

    Hi,
    I wonder for a given sql query, after the system optimization, can I see the query plan in oracle? If yes, how to do that? thank you.
    Xing

    You can use explain plan in SQLPlus
    SQL>  explain plan for select * from user_tables;
    Explained.
    Elapsed: 00:00:01.63
    SQL> select * from table(dbms_xplan.display());
    PLAN_TABLE_OUTPUT
    Plan hash value: 806004009
    | Id  | Operation                       | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                |          |  2014 |  1123K|   507   (6)| 00:00:07 |
    |*  1 |  HASH JOIN RIGHT OUTER          |          |  2014 |  1123K|   507   (6)| 00:00:07 |
    |   2 |   TABLE ACCESS FULL             | SEG$     |  4809 |   206K|    34   (3)| 00:00:01 |
    |*  3 |   HASH JOIN RIGHT OUTER         |          |  1697 |   873K|   472   (6)| 00:00:06 |
    |   4 |    TABLE ACCESS FULL            | USER$    |    74 |  1036 |     3   (0)| 00:00:01 |
    |*  5 |    HASH JOIN OUTER              |          |  1697 |   850K|   468   (6)| 00:00:06 |
    |   6 |     NESTED LOOPS OUTER          |          |  1697 |   836K|   315   (6)| 00:00:04 |
    |*  7 |      HASH JOIN                  |          |  1697 |   787K|   226   (8)| 00:00:03 |
    |   8 |       TABLE ACCESS FULL         | TS$      |    13 |   221 |     5   (0)| 00:00:01 |
    |   9 |       NESTED LOOPS              |          |  1697 |   759K|   221   (8)| 00:00:03 |
    |  10 |        MERGE JOIN CARTESIAN     |          |  1697 |   599K|   162  (10)| 00:00:02 |
    |* 11 |         HASH JOIN               |          |     1 |   326 |     1 (100)| 00:00:01 |
    |* 12 |          FIXED TABLE FULL       | X$KSPPI  |     1 |    55 |     0   (0)| 00:00:01 |
    |  13 |          FIXED TABLE FULL       | X$KSPPCV |   100 | 27100 |     0   (0)| 00:00:01 |
    |  14 |         BUFFER SORT             |          |  1697 | 61092 |   162  (10)| 00:00:02 |
    |* 15 |          TABLE ACCESS FULL      | OBJ$     |  1697 | 61092 |   161  (10)| 00:00:02 |
    |* 16 |        TABLE ACCESS CLUSTER     | TAB$     |     1 |    96 |     1   (0)| 00:00:01 |
    |* 17 |         INDEX UNIQUE SCAN       | I_OBJ#   |     1 |       |     0   (0)| 00:00:01 |
    |  18 |      TABLE ACCESS BY INDEX ROWID| OBJ$     |     1 |    30 |     1   (0)| 00:00:01 |
    |* 19 |       INDEX UNIQUE SCAN         | I_OBJ1   |     1 |       |     0   (0)| 00:00:01 |
    |  20 |     TABLE ACCESS FULL           | OBJ$     | 52728 |   411K|   151   (4)| 00:00:02 |
    Predicate Information (identified by operation id):
       1 - access("T"."FILE#"="S"."FILE#"(+) AND "T"."BLOCK#"="S"."BLOCK#"(+) AND
                  "T"."TS#"="S"."TS#"(+))
       3 - access("CX"."OWNER#"="CU"."USER#"(+))
       5 - access("T"."DATAOBJ#"="CX"."OBJ#"(+))
       7 - access("T"."TS#"="TS"."TS#")
      11 - access("KSPPI"."INDX"="KSPPCV"."INDX")
      12 - filter("KSPPI"."KSPPINM"='_dml_monitoring_enabled')
      15 - filter("O"."OWNER#"=USERENV('SCHEMAID') AND BITAND("O"."FLAGS",128)=0)
      16 - filter(BITAND("T"."PROPERTY",1)=0)
      17 - access("O"."OBJ#"="T"."OBJ#")
      19 - access("T"."BOBJ#"="CO"."OBJ#"(+))
    42 rows selected.
    Elapsed: 00:00:03.61
    SQL> If your plan table does not exist, execute the script $ORACLE_HOME/RDBMS/ADMIN/utlxplan.sql to create the table.

  • How to display attributes in the query

    Hi frnds,
    I want to show the attributes of material ( mat group , mat type ), vendor ( Sort field ) in the report.
    We loaded master data for material and vendor.
    I dragged the char and the relevant attributes in the query designer and executed the query. But in the output the attributes values are not displayed.
    What could the reason ?
    Regards,
    V N.

    Hi all,
    Thanks for the reply.
    "Display attributes will also get displayed if you include the infoobject for which they are attributes."
    Suppose for 0vendor the attr is 0sortl. By defualt it is display attr. I dragged in the query the 0vendor and its attr 0sortl  and executed. It didnot displayed any values for this 0sortl
    I changed it to Nav Attr. And rerun the query, it is displaying values.
    In the first case i included Display attr and the infoobject for which it is attr in the query. Please explain me why it didnot displayed the values.
    And after changing it to Nav attr it displayed the values.
    Please explain me what happened actually.
    Regards,
    V N.

  • Sorting in the variable screen

    Hello,
    I use BW 7.0 and have a problem with the variable screen.
    In the web-report I have three queries with different and same variables. I know that I can adjust the sorting of variables in the query designer. But this has no affect to the sorting of the variable screen.
    Does anybody know a solution?
    thanks
    bertl

    Hi,
    You can sort the Char.Values by doing settings in Query Designer :
    Say for 0calmonth :
    In its Display properties tab,You select appropriate options in
    Sort Char -> select the name
    sort by -> Key/Text
    Sort Direction -> Ascending/Descending.
    You will then have them in required order.
    ALso if you want it only for F4 help:
    In F4 help screen,you will see two arrow buttons next to Char. name. they are useful for sorting the values to either descending or ascending.
    Hope it helps:)

Maybe you are looking for

  • Drop frames on external monitor

    Hi, recently im having some troubles with cc 7.2.1, one of them is when i have cuda enabled i have droped frames on my external and program monitor, but the timeline is fast and i can edit, im editing a short documentary with 4 hours of footage in h2

  • Which is the mandatory event in report program?

    which is the mandatory event in report program? Plz its urgent

  • My files are there but wont show on desktop

    My files are there if I look into desktop folder through the finder but In the real scenario of Desktop The files does not display on the Desktop although they are there. how do I make them appear on the desktop

  • 9.0 2 Patch Update

    Am I able to install the 9.02 Patch update if I have Robohelp 8? Thanks

  • Any Plans To Update?

    The most current version of iOS Photoshop Touch is version 1.3 which was released in September but only included bug fixes for iOS 8. Are there any plans to update this app with more functionality now that the iPhone 6 and 6 Plus have been released.