Query tuning (Oracle 10g)

Hi
We are having one query that is having order by clause. If we run with order by then it takes 70-80 min to execute and without order by it takes 1-2 min.
We cann't remove order by because of business requirements.
Please suggest me any solution except index, hints (already there).
Thanks and regards

What is your database version? If you are using an automated PGA memory management then you might want to check your PGA_AGGREGATE_TARGET.
You can use V$PGA_TARGET_ADVICE to set up a proper PGA_AGGREGATE_TARGET.
Read more about PGA Memory management here
http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/memory.htm#i49320
It has a lot to do with Sorting Operations.
Thanks,
Karthick.

Similar Messages

  • Issue with "Select Distinct" query in Oracle 10g against Oracle 9i

    Hi,
    I would appreciate if some one help me here because it is really urgent.
    We are upgrading our database from 9i to 10g.
    There are the "Select distinct" queries in the code which populated the grid on the applications screens. We found a difference in 9i and 10g the way the result is populated for these queries. If "Select Distinct" query wihtout a order by clause is executed in 9i then the result is automatically sorted. But Oracle 10g does not do this.
    We can change the queries adding order by clause but we are almost at the end of the testing and want to know if there is any way that we can do this from database settings. Would there be any impact of these settings change on overall operation of Oracle 10g?
    I would appreciate if some one can help me here.
    Thanks,
    Dinesh

    then the result is automatically sorted.No. Oracle may have done a sort operation to perform the distinct, but it still did not guarantee the order of your results.
    In 10g and in 9i, if you want your results in a certain order you must use order by.

  • Query  regarding oracle 10g connection in Visual Studio 2005

    Hi ,
    I am having visual studio 2005 installed in my system . when i am adding oracle database connection it is displaying that "use this connection for oracle 7 ,8, 9i versions ..i want to connect oracle 10g database in visual studio 2005. plz tell me how to do that?

    looks like u'r try connecting to oracle using server explorer, just hit OK an then fill in your server name, userid and password.
    server name might be SID defined in your tnsnames.ora, or in the form of //<machine_name>/<service_name>

  • Performance tuning oracle 10G on Windows 2003

    Hi,
    At present we have 8GB physical RAM on Production server while the parameters sga_max_size = 1 GB and pga_aggregate_target = 629 MB are defined.
    When I hit transaction ST02 I observed that values for swaps are showing in red color for program, screen, Export/import, generic key buffers etc. We cannot restart the SAP more than once in a week, and it increases the number of swaps.
    We have plan to increase the buffer size by twice for program, screen, Export/import, CUA, Nametab, generic key buffers etc. The addition of current value for all this buffers is defined up to 350MB.
    I want to know if I increase this value by twice is it cause any problem to system or I need to increase the size of sga_max_size and pga_aggregate_target also.
    Is sga_max_size and pga_aggregate_target parameters are related to program buffer or screen buffer or generic key buffers.
    Thanks & Regards,
    Rajesh

    Hi,
    check following SAP Notes
    Note 618868 - FAQ: Oracle performance
    Note 830576 - Parameter recommendations for Oracle 10g
    Note 88416 - Zero administration memory management as of 4.0A/ Windows
    Note 546361 - FAQ: Storage problems on NT/Windows 2000
    Note 103747 - Performance: Parameter recommendations as of Release 4.0
    regards,
    kaushal

  • Query Optimization (Oracle 10g)

    Hi All,
    I have written a query. But It's taking around 15 minutes. Can you please check the query and Explain plan of the query and give me the solution for optimize the query.
    Query :
    SELECT *
      FROM temp.r_view
    WHERE cur IN (SELECT p_id_d
                          FROM temp.pm
                         WHERE p_id_h = 'CURRENCY' AND p_txt
                                   = 'EUR')
       AND rec_amt >= 10
       AND r_view.date_exec >
              TO_DATE ((SELECT p_txt
                          FROM temp.pm
                         WHERE p_id_h = 'MONETARY'
                           AND p_id_d = 'LAST_DATE'
                           AND p_id_t = 'S'),
                       'DD-MON-YYYY'
       AND SID NOT IN (
              SELECT gl_sid
                FROM s_wr.p_smst
               WHERE p_gst.p_idc =
                           (SELECT p_txt
                              FROM temp.pm
                             WHERE p_id_h  = 'MONETARY'
                             AND   pm_id_d = 'MONETARY_ID'));
    OPERATION     OPTIONS         OBJECT_NAME      POSITION
    SELECT STATEMENT                        199600
    FILTER                                         1
    HASH JOIN     RIGHT SEMI                    1
    TABLE ACCESS     FULL             PM               1
    VIEW          R_VIEW                               2
    UNION-ALL                                 1
    TABLE ACCESS     FULL             IN_CUST_TEMP       1
    TABLE ACCESS     FULL             RC_REG_WORK       2
    HASH            JOIN                            3
    VIEW                          V_SQ_1               1
    HASH             GROUP BY                            1
    TABLE ACCESS     FULL             TP_MAIN_WORK       1
    TABLE ACCESS     FULL             TP_MAIN_WORK       2
    TABLE ACCESS     FULL             IN_SS_RELOAD       4
    TABLE ACCESS     FULL             CTF_AORD_WORK       5
    TABLE ACCESS     FULL             MANXA_RELOAD       6
    TABLE ACCESS     FULL             STX_FR_PURSE       7
    TABLE ACCESS     BY INDEX ROWID     PM               2
    INDEX             RANGE SCAN     K_PRM             1
    TABLE ACCESS     BY INDEX ROWID     P_GST               2
    INDEX             RANGE SCAN     ID1_P_GST         1
    TABLE ACCESS     BY INDEX ROWID     PM               1
    INDEX             RANGE SCAN     K_PM               1Thank you

    user636482 wrote:
    I have written a query. But It's taking around 15 minutes. Can you please check the query and Explain plan of the query and give me the solution for optimize the query.Since you're already on 10g, please use DBMS_XPLAN.DISPLAY to generate a more meaningful output of the EXPLAIN PLAN command.
    Please read this HOW TO: Post a SQL statement tuning request - template posting that explains what you should provide if you have SQL statement tuning question and how to format it here so that the posted information is readable by others.
    This accompanying blog post shows step-by-step instructions how to obtain that information.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Query tuning in 10g

    In quey tuning
    1. purpose of optimizer mode
    2. why we need to take statistics and analyse tables and schemas
    I have been searching in the google but i didn't get solution.
    please help me.
    regards,
    rajesh

    1. purpose of optimizer mode
    Ans-> From 10g onwards default optimizer mode is all_rows which is cost based model. Prior to 10g default was "choose" which tell optimizer to use Rulebased model if statistics of objects are missing otherwise use cost based model.
    In 10g optimizer can have three values a) all_rows (cost will be calculated based on retuning all rows as soon as possible) b) first_rows (Cost will be calculated based on returning first row as soon as possible) c) first_rows_n (N is integer here and cost will be calculated to get N rows as soon as possible).
    2. why we need to take statistics and analyse tables and schemas
    In cost based model, optimizer need objects statistics to decide the best execution plans. Optimizer takes values like NULL,NDV,NUM_ROWS etc from dba_tables,dba_indexes etc to decide plans. If however these are not available then optimizer might get wrong execution plan because it take default values which could have hugh impact.
    Beside this optimizer takes other factors as well like Init parameters,system statistics,Hints.
    And here is the best artical available to explain about optimizer, please have a look. http://www.oracle.com/technetwork/database/focus-areas/bi-datawarehousing/twp-explain-the-explain-plan-052011-393674.pdf
    Regards

  • Getting error "Column is not indexed " when executing query on ORACLE 10g

    Hi all,
    When executing the below query im getting the error "ORA-20000:Column is not indexed"
    query:
    select xmlelement("nexml:result",xmlattributes('http://namespaces.nextance.com/nex/xml' as "xmlns:nexml"),xmlelement("nexml:value",count(*))).getClobVal()
    from "permission"
    where ( ((contains(object_value,'(searchDocument) inpath(/permission/action)') > 0)) and ((existsNode(object_value,'/permission[resource/resourcekey/@type[. = "document"]]') = 1)) and ((contains(object_value,'(GeneralUser) inpath(/permission/principal/@name)') > 0)) and ((existsNode(object_value,'/permission[principal/@type[. = "group"]]') = 1)) and ((existsNode(object_value,'/permission[type[. = "allow"]]') = 1)) and ((contains(object_value,'(nexip) inpath(/permission/resource/resourcekey/field/@value)') > 0) or (contains(object_value,'(Corporate) inpath(/permission/resource/resourcekey/field/@value)') > 0) or (contains(object_value,'(ProcurementAgreement) inpath(/permission/resource/resourcekey/field/@value)') > 0) or (contains(object_value,'(Procurement) inpath(/permission/resource/resourcekey/field/@value)') > 0) or (contains(object_value,'(SalesAgreement) inpath(/permission/resource/resourcekey/field/@value)') > 0)) )
    Then after checking some forum, i replaced "contains" with "ora:contains" and executed the query. Now im not getting the first error but got a new error "invalid relational operator"
    So please help me in resolving the errors?
    Thanks in advance.

    Anil kumar wrote:
    Hi,
    Thanks for your reply. Could you please explain your solution in detail?Hi,
    I just have a try...
    create table t (id int,my_lob clob)
    begin
    insert into t values(101,'Oracle redwood shores USA');
    insert into t values (102,'HP palo alto USA');
    insert into t values(103,'Capgemini  FRANCE');;
    end;
    create index my_idx on t(my_lob) indextype is ctxsys.context
    select *
    from t
    where contains(my_lob,'USA',1)>0
    Output
    ID      MY_LOB
    101     Oracle redwood shores USA
    102     HP palo alto USA Hope it helps,
    CKLP

  • How To Write A Matrix Query in Oracle 10g

    Hi All,
    I need to write a query displaying total of each Month and each quarter total. Here is example:
    CREATE TABLE T_CUST_REG(
    CUST_ID NUMBER,
    CUST_NAME VARCHAR2(255),
    REGDATE  DATE);
    INSERT INTO T_CUST_REG VALUES (1, 'A','01-JAN-2012');
    INSERT INTO T_CUST_REG VALUES (2, 'B','01-FEB-2012');
    INSERT INTO T_CUST_REG VALUES (3, 'C','01-MAR-2012');
    INSERT INTO T_CUST_REG VALUES (4, 'D','01-APR-2012');
    INSERT INTO T_CUST_REG VALUES (5, 'E','01-MAY-2012');
    INSERT INTO T_CUST_REG VALUES (6, 'F','01-JUN-2012');
    INSERT INTO T_CUST_REG VALUES (7, 'G','01-JUL-2012');
    INSERT INTO T_CUST_REG VALUES (8, 'H','01-AUG-2012');
    INSERT INTO T_CUST_REG VALUES (9, 'I','01-SEP-2012');
    INSERT INTO T_CUST_REG VALUES (10, 'J','01-OCT-2012');
    INSERT INTO T_CUST_REG VALUES (11, 'K','01-NOV-2012');
    INSERT INTO T_CUST_REG VALUES (12, 'L','01-DEC-2012');
    Output REQUIRED:
    JAN
    FEB
    MAR
    Q1
    APR
    MAY
    JUN
    Q2
    JUL
    AUG
    SEP
    Q3
    OCT
    NOV
    DEC
    Q4
    1
    1
    1
    3
    1
    1
    1
    3
    1
    1
    1
    3
    1
    1
    1
    3
    I am able to create matrix with following query, but issue is how to put Quarter(total) in between.
    Select Count(1), TO_CHAR(REGDATE, 'MON') MON 
    FROM T_CUST_REG T
    GROUP BY TO_CHAR(REGDATE, 'MON');
    Regards

    Hi,
    The query you posted will produce a separate row for each month, not a separate column.  Is that what you want?
    If so, you can add the quarterly totals with GROUPING SETS, like this:
    SELECT    COUNT (*)    AS cnt
    ,         CASE
                  WHEN  GROUPING (TRUNC (regdate, 'MONTH')) = 0
                  THEN  TO_CHAR (TRUNC (regdate, 'MONTH'), 'YYYY MON')
                  ELSE  TO_CHAR (TRUNC (regdate, 'Q'),     'YYYY "Q"Q')
              END          AS label
    FROM      t_cust_reg
    GROUP BY  GROUPING SETS ( (TRUNC (regdate, 'MONTH'))
                            , (TRUNC (regdate, 'Q'))
    Instead of calling TRUNC over and over, you might want to do it just 2 times, in a sub-query, giving aliases to the results, and then use the aliases over and over in the main query.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and the exact results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    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

  • Cannot use Flashback Versions Query in Oracle 10g

    If I want use Flashback Versions Query for one Table in my Database 10.1.0.4 then I receive follow error message:
    500 Internal Server Error
    java.lang.RuntimeException: options is null
         at oracle.sysman.emSDK.jsp.ListBean.applyAttributes(ListBean.java:70)
         at oracle.sysman.emSDK.jsp.ShuttleBean.render(ShuttleBean.java:41)
         at oracle.cabo.ui.BaseUINode.render(Unknown Source)
         at oracle.cabo.ui.BaseRenderer.renderChild(Unknown Source)
         at oracle.cabo.ui.BaseRenderer.renderIndexedChild(Unknown Source)
         at oracle.cabo.ui.BaseRenderer.renderIndexedChild(Unknown Source)
         at oracle.cabo.ui.BaseRenderer.renderContent(Unknown Source)
         at oracle.cabo.ui.BaseRenderer.render(Unknown Source)
         at oracle.cabo.ui.laf.xhtml.XhtmlLafRenderer.render(Unknown Source)
         at oracle.cabo.ui.BaseUINode.render(Unknown Source)
         at oracle.cabo.ui.BaseUINode.render(Unknown Source)
         at oracle.cabo.ui.BaseRenderer.renderChild(Unknown Source)
         at oracle.cabo.ui.laf.xhtml.RowLayoutRenderer.renderChild(Unknown Source)
         at oracle.cabo.ui.BaseRenderer.renderIndexedChild(Unknown Source)
         at oracle.cabo.ui.BaseRenderer.renderIndexedChild(Unknown Source)
         at oracle.cabo.ui.BaseRenderer.renderContent(Unknown Source)
         at oracle.cabo.ui.BaseRenderer.render(Unknown Source)
         at oracle.cabo.ui.laf.xhtml.XhtmlLafRenderer.render(Unknown Source)
         at oracle.cabo.ui.BaseUINode.render(Unknown Source)
         at oracle.cabo.ui.BaseUINode.render(Unknown Source)
         at oracle.cabo.ui.BaseRenderer.renderChild(Unknown Source)
         at oracle.cabo.ui.BaseRenderer.renderIndexedChild(Unknown Source)
         at oracle.cabo.ui.BaseRenderer.renderIndexedChild(Unknown Source)
         at oracle.cabo.ui.BaseRenderer.renderContent(Unknown Source)
         at oracle.cabo.ui.BaseRenderer.render(Unknown Source)
    .... and so on
    Can any of you help me?

    At what stage did you get this error?. Have you already selected the type of Flash Back Versions Query you want e.g Specifying type of Point in Time (Row Evaluation, Timestamp or SCN) or just when you select from the Action?

  • Query tuning - oracle 11g

    Hi all,
    Query executes for more 1.5 hours. fetches the data from a remote database. more than million records.
    any suggestions to tune the query?
    Explain Plan
    CREATE TABLE STATEMENT  ALL_ROWSCost: 3,777  Bytes: 1,161,660  Cardinality: 15,285                      
         5 LOAD AS SELECT hcl_delta_TMP_2                
              4 NESTED LOOPS  Cost: 3,768  Bytes: 1,161,660  Cardinality: 15,285            
                   2 SORT UNIQUE  Cost: 1  Bytes: 693  Cardinality: 99       
                        1 INDEX FULL SCAN INDEX (UNIQUE) DELTA_REASON_CODES_PK Cost: 1  Bytes: 693  Cardinality: 99 
                   3 REMOTE REMOTE SERIAL_FROM_REMOTE PSM_LIB_LOG_R RMDB Cost: 74  Bytes: 10,626  Cardinality: 154       
    Query:
    CREATE TABLE hcl_delta_tmp_2 AS
    SELECT
    'hcl' AS heritage,
    load_dt,
    process_dt,
    update_status_cd,
    loan_number,
    lib_date,
    lib_time,
    lib_code,
    lib_user_id,
    lib_log_key_date_time
    FROM psm_lib_log_r@RMDB a
    WHERE a.process_dt >= TO_DATE('01/01/2010','MM/DD/YYYY') AND
    a.update_status_cd NOT IN( 'P' ) AND
    a.lib_code IN
    SELECT TRIM(delta_code) AS delta_code
    FROM delta_reason_codes
    Delta code column is a primary key in table delta_reason_codes: DELTA_REASON_CODES_PKVersion : Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    thanks.

    I think I am getting conflicting information about how many rows are in the remote table.
    First we read that the remote table has more than 10 million records and then we read that applying this where clause WHERE a.process_dt >= TO_DATE('01/01/2010','MM/DD/YYYY')
      AND a.update_status_cd NOT IN ('P') Results in that will be too many records, more than 10 millions.What are the total number of rows in the remote table?
    How many rows match the date condition by itself?
    How many match the status code condition by itself?
    How many match the lib_code condition by itself?
    How many rows match all conditions (the number returned by the query)?
    Sorry, but I am just trying clear up any confusion here.

  • Will the query run Oracle 10g?

    Hi,
    Below is the structure of the emp and dept table.There is a query based on this, please let me know if this query will work ?
    Table EMP
    =========
    EMPID NUMBER PRIMARY KEY,
    NAME
    ADDRESS
    Table DEPT
    ==========
    DEPTNO NUMBER,
    DEPTNAME
    select * from emp where empid in ( select empid from dept where dept_no = 10 ) ;

    Nordik wrote:
    Hi,
    Below is the structure of the emp and dept table.There is a query based on this, please let me know if this query will work ?
    Table EMP
    =========
    EMPID NUMBER PRIMARY KEY,
    NAME
    ADDRESS
    Table DEPT
    ==========
    DEPTNO NUMBER,
    DEPTNAME
    select * from emp where empid in ( select empid from dept where dept_no = 10 ) ;Yes, It will run.
    Oracle will first check if column EMPID exists in DEPT table.
    If it does not, then it checks for the Columns presence in Outer query.
    And this happens, because you did not use Table Alias. Had an Alias been used, the column would have been checked only in the Aliased table.
    Moreover, you would not lose anything but to check the query on a database, would you?
    Easy enough to check this, right?
    create table test_table (col1 number, col2 varchar2(5));
    create table test_table2 (col1 number);
    select *
      from test_table t1
    where col2 in (select col2 from test_table2 t2 where t1.col1 = t2.col1);
    no rows returned

  • Optimisation of query in Oracle 10g

    I have done explain plan for a query and the cost is shoing for the operaions used in the query.
    How can i judge whether the query is taking longer time by cost???
    Please can anyone help on this topic
    Regards

    Hi hkandpal ,
    The query is below:
    SELECT
    0,
    b.to_whse,
    c.item_id,
    b.recv_date,
    decode(a.attribute1,'1',0,1),
    'RECV',
    decode(a.attribute1,'0','DA','1','TIM-DA','2','DE','DA'),
    a.attribute2,
    b.recv_qty1,
    (b.recv_qty1 * b.net_price * b.receipt_exchange_rate),
    0,
    0,
    decode(a.attribute1,'2',a.attribute2,' '),
    a.payvend_id,
    0,
    0,
    0,
    SYSDATE,
    SYSDATE,
    fnd_global.user_id,
    fnd_global.user_id,
    fnd_global.login_id,
    a.of_vendor_id
    FROM xxpepgr_po_recv_dtl b,
    xxpepgr_po_recv_hdr a,
    ic_item_mst c
    WHERE c.inv_type = 'RM'
    AND c.delete_mark = 0
    AND b.item_id = c.item_id
    AND a.recv_id = b.recv_id
    AND a.void_ind = 0
    AND NVL(b.recv_status,0) = 0
    AND a.delete_mark = 0
    -- Commented below code by Akshya.S, OSSI 06-DEC-2006 as part of 11.5.10 upgrade
    --AND    TO_CHAR(a.recv_date,'yyyymmdd') >= v_date1
    --AND    TO_CHAR(a.recv_date,'yyyymmdd') <= v_date2
    -- Commented above code by Akshya.S, OSSI 06-DEC-2006 as part of 11.5.10 upgrade
    -- Inserted below code by Akshya.S, OSSI 06-DEC-2006 as part of 11.5.10 upgrade
    AND ( (a.opm_hist_status = 'N'
    AND TO_CHAR(b.recv_date,'yyyymmdd') >= 20071101 --AKS
    AND TO_CHAR(b.recv_date,'yyyymmdd') <= 20071119 --AKS
    OR( a.opm_hist_status = 'O'
    AND TO_CHAR(a.recv_date,'yyyymmdd') >= 20071101 --AKS
    AND TO_CHAR(a.recv_date,'yyyymmdd') <= 20071119 --AKS
    -- Inserted above code by Akshya.S, OSSI 06-DEC-2006 as part of 11.5.10 upgrade
    -- Commented by Akshya.S, OSSI 28-NOV-2006 as part of 11.5.10 upgrade
    --AND    b.recv_qty1 > 0.001);
    -- Inserted below code by Akshya.S, OSSI 28-NOV-2006 as part of 11.5.10 upgrade
    AND ( b.recv_qty1 > 0.001
         OR b.recv_qty1 < 0.001);
    and below is the explained plan output for the query:
    GETRECV1     11/21/2007 8:46:55 AM          SELECT STATEMENT                                   ALL_ROWS          0          1127     1127     6     2346                         
    GETRECV1     11/21/2007 8:46:55 AM          NESTED LOOPS                                             1     0     1     1127     6     2346                         
    GETRECV1     11/21/2007 8:46:55 AM          HASH JOIN                                             2     1     1     1127     5     1920                         
    GETRECV1     11/21/2007 8:46:55 AM          HASH JOIN                                             3     2     1     832     762     67818                         
    GETRECV1     11/21/2007 8:46:55 AM          TABLE ACCESS     FULL          GMI     IC_ITEM_MST_B     5     TABLE     ANALYZED          4     3     1     42     236     2596                         
    GETRECV1     11/21/2007 8:46:55 AM          VIEW               XXTF     XXPEPGR_PO_RECV_DTL     1     VIEW               5     3     2     789     12247     955266                         
    GETRECV1     11/21/2007 8:46:55 AM          UNION-ALL                                             6     5     1                                        
    GETRECV1     11/21/2007 8:46:55 AM          NESTED LOOPS                                             7     6     1     490     14     3290                         
    GETRECV1     11/21/2007 8:46:55 AM          NESTED LOOPS                                             8     7     1     490     14     3220                         
    GETRECV1     11/21/2007 8:46:55 AM          NESTED LOOPS                                             9     8     1     476     14     3052                         
    GETRECV1     11/21/2007 8:46:55 AM          NESTED LOOPS                                             10     9     1     476     14     2954                         
    GETRECV1     11/21/2007 8:46:55 AM          NESTED LOOPS                                             11     10     1     462     14     2800                         
    GETRECV1     11/21/2007 8:46:55 AM          NESTED LOOPS                                             12     11     1     448     14     2576                         
    GETRECV1     11/21/2007 8:46:55 AM          HASH JOIN                                             13     12     1     434     14     2380                         
    GETRECV1     11/21/2007 8:46:55 AM          NESTED LOOPS     OUTER                                        14     13     1     432     14     2254                         
    GETRECV1     11/21/2007 8:46:55 AM          NESTED LOOPS     OUTER                                        15     14     1     432     14     2156                         
    GETRECV1     11/21/2007 8:46:55 AM          NESTED LOOPS     OUTER                                        16     15     1     432     14     2058                         
    GETRECV1     11/21/2007 8:46:55 AM          HASH JOIN                                             17     16     1     432     14     1960                         
    GETRECV1     11/21/2007 8:46:55 AM          TABLE ACCESS     FULL          PO     PO_LINE_LOCATIONS_ALL     41     TABLE     ANALYZED          18     17     1     225     216     2376                         
    GETRECV1     11/21/2007 8:46:55 AM          VIEW               XXTF          17                    19     17     2     206     1393     179697                         
    GETRECV1     11/21/2007 8:46:55 AM          UNION-ALL                                             20     19     1                                        
    GETRECV1     11/21/2007 8:46:55 AM          TABLE ACCESS     FULL          PO     RCV_TRANSACTIONS     18     TABLE     ANALYZED          21     20     1     90     1369     80771                         
    GETRECV1     11/21/2007 8:46:55 AM          NESTED LOOPS                                             22     20     2     116     24     2208                         
    GETRECV1     11/21/2007 8:46:55 AM          HASH JOIN                                             23     22     1     92     24     1800                         
    GETRECV1     11/21/2007 8:46:55 AM          TABLE ACCESS     FULL          INV     MTL_TRANSACTION_REASONS     21     TABLE     ANALYZED          24     23     1     2     1     10                         
    GETRECV1     11/21/2007 8:46:55 AM          TABLE ACCESS     FULL          PO     RCV_TRANSACTIONS     19     TABLE     ANALYZED          25     23     2     90     1369     88985                         
    GETRECV1     11/21/2007 8:46:55 AM          TABLE ACCESS     BY INDEX ROWID          PO     RCV_TRANSACTIONS     20     TABLE     ANALYZED          26     22     2     1     1     17                         
    GETRECV1     11/21/2007 8:46:55 AM          INDEX     UNIQUE SCAN          PO     RCV_TRANSACTIONS_U1          INDEX (UNIQUE)     ANALYZED     1     27     26     1     0     1                              
    GETRECV1     11/21/2007 8:46:55 AM          INDEX     UNIQUE SCAN          INV     MTL_UNITS_OF_MEASURE_TL_U1          INDEX (UNIQUE)     ANALYZED     2     28     16     2     0     1     7                         
    GETRECV1     11/21/2007 8:46:55 AM          INDEX     UNIQUE SCAN          INV     MTL_UNITS_OF_MEASURE_TL_U1          INDEX (UNIQUE)     ANALYZED     2     29     15     2     0     1     7                         
    GETRECV1     11/21/2007 8:46:55 AM          INDEX     UNIQUE SCAN          INV     MTL_UNITS_OF_MEASURE_TL_U1          INDEX (UNIQUE)     ANALYZED     2     30     14     2     0     1     7                         
    GETRECV1     11/21/2007 8:46:55 AM          TABLE ACCESS     FULL          GMI     IC_WHSE_MST     23     TABLE     ANALYZED          31     13     2     2     32     288                         
    GETRECV1     11/21/2007 8:46:55 AM          TABLE ACCESS     BY INDEX ROWID          PO     RCV_SHIPMENT_LINES     16     TABLE     ANALYZED          32     12     2     1     1     14                         
    GETRECV1     11/21/2007 8:46:55 AM          INDEX     UNIQUE SCAN          PO     RCV_SHIPMENT_LINES_U1          INDEX (UNIQUE)     ANALYZED     1     33     32     1     0     1                              
    GETRECV1     11/21/2007 8:46:55 AM          TABLE ACCESS     BY INDEX ROWID          INV     MTL_SYSTEM_ITEMS_B     37     TABLE     ANALYZED          34     11     2     1     1     16                         
    GETRECV1     11/21/2007 8:46:55 AM          INDEX     UNIQUE SCAN          INV     MTL_SYSTEM_ITEMS_B_U1          INDEX (UNIQUE)     ANALYZED     2     35     34     1     0     1                              
    GETRECV1     11/21/2007 8:46:55 AM          TABLE ACCESS     BY INDEX ROWID          GMI     IC_ITEM_MST_B     34     TABLE     ANALYZED          36     10     2     1     1     11                         
    GETRECV1     11/21/2007 8:46:55 AM          INDEX     UNIQUE SCAN          GMI     IC_ITEM_MST_B_UNQ1          INDEX (UNIQUE)     ANALYZED     1     37     36     1     0     1                              
    GETRECV1     11/21/2007 8:46:55 AM          INDEX     UNIQUE SCAN          GMI     IC_ITEM_MST_TL_PK          INDEX (UNIQUE)     ANALYZED     2     38     9     2     0     1     7                         
    GETRECV1     11/21/2007 8:46:55 AM          INDEX     UNIQUE SCAN          INV     MTL_SYSTEM_ITEMS_TL_U1          INDEX (UNIQUE)     ANALYZED     3     39     8     2     1     1     12                         
    GETRECV1     11/21/2007 8:46:55 AM          INDEX     UNIQUE SCAN          PO     RCV_SHIPMENT_HEADERS_U1          INDEX (UNIQUE)     ANALYZED     1     40     7     2     0     1     5                         
    GETRECV1     11/21/2007 8:46:55 AM          HASH JOIN                                             41     6     2     299     12233     868543                         
    GETRECV1     11/21/2007 8:46:55 AM          TABLE ACCESS     FULL          GML     PO_RECV_HDR     30     TABLE     ANALYZED          42     41     1     136     24195     193560                         
    GETRECV1     11/21/2007 8:46:55 AM          HASH JOIN     RIGHT OUTER                                        43     41     2     162     12233     770679                         
    GETRECV1     11/21/2007 8:46:55 AM          TABLE ACCESS     FULL          GML     CPG_ORAGEMS_MAPPING     32     TABLE     ANALYZED          44     43     1     19     5428     43424                         
    GETRECV1     11/21/2007 8:46:55 AM          NESTED LOOPS     OUTER                                        45     43     2     143     12233     672815                         
    GETRECV1     11/21/2007 8:46:55 AM          TABLE ACCESS     FULL          GML     PO_RECV_DTL     29     TABLE     ANALYZED          46     45     1     141     12233     623883                         
    GETRECV1     11/21/2007 8:46:55 AM          INDEX     UNIQUE SCAN          GML     PO_VEND_MST_PK          INDEX (UNIQUE)     ANALYZED     1     47     45     2     0     1     4                         
    GETRECV1     11/21/2007 8:46:55 AM          VIEW               XXTF     XXPEPGR_PO_RECV_HDR     2     VIEW               48     2     2     294     12732     3755940                         
    GETRECV1     11/21/2007 8:46:55 AM          UNION-ALL                                             49     48     1                                        
    GETRECV1     11/21/2007 8:46:55 AM          NESTED LOOPS                                             50     49     1     119     634     45648                         
    GETRECV1     11/21/2007 8:46:55 AM          NESTED LOOPS     OUTER                                        51     50     1     119     634     43112                         
    GETRECV1     11/21/2007 8:46:55 AM          HASH JOIN                                             52     51     1     119     634     39942                         
    GETRECV1     11/21/2007 8:46:55 AM          VIEW               XXTF          7                    53     52     1     97     634     13948                         
    GETRECV1     11/21/2007 8:46:55 AM          HASH     UNIQUE                                        54     53     1     97     634     25360                         
    GETRECV1     11/21/2007 8:46:55 AM          HASH JOIN                                             55     54     1     96     634     25360                         
    GETRECV1     11/21/2007 8:46:55 AM          TABLE ACCESS     FULL          INV     MTL_ITEM_LOCATIONS     9     TABLE     ANALYZED          56     55     1     6     117     1053                         
    GETRECV1     11/21/2007 8:46:55 AM          TABLE ACCESS     FULL          PO     RCV_TRANSACTIONS     8     TABLE     ANALYZED          57     55     2     90     634     19654                         
    GETRECV1     11/21/2007 8:46:55 AM          TABLE ACCESS     FULL          PO     RCV_SHIPMENT_HEADERS     6     TABLE     ANALYZED          58     52     2     21     3152     129232                         
    GETRECV1     11/21/2007 8:46:55 AM          INDEX     UNIQUE SCAN          GML     OP_SHIP_MST01          INDEX (UNIQUE)     ANALYZED     1     59     51     2     0     1     5                         
    GETRECV1     11/21/2007 8:46:55 AM          INDEX     UNIQUE SCAN          GMI     IC_WHSE_MST_U1          INDEX (UNIQUE)     ANALYZED     1     60     50     2     0     1     4                         
    GETRECV1     11/21/2007 8:46:55 AM          NESTED LOOPS     OUTER                                        61     49     2     174     12098     556508                         
    GETRECV1     11/21/2007 8:46:55 AM          HASH JOIN     RIGHT OUTER                                        62     61     1     174     12098     508116                         
    GETRECV1     11/21/2007 8:46:55 AM          TABLE ACCESS     FULL          GML     PO_VEND_MST     13     TABLE     ANALYZED          63     62     1     37     4961     44649                         
    GETRECV1     11/21/2007 8:46:55 AM          TABLE ACCESS     FULL          GML     PO_RECV_HDR     12     TABLE     ANALYZED          64     62     2     136     12098     399234                         
    GETRECV1     11/21/2007 8:46:55 AM          INDEX     UNIQUE SCAN          GML     PO_VEND_MST_PK          INDEX (UNIQUE)     ANALYZED     1     65     61     2     0     1     4                         
    GETRECV1     11/21/2007 8:46:55 AM          INDEX     UNIQUE SCAN          GMI     IC_ITEM_MST_TL_PK          INDEX (UNIQUE)     ANALYZED     2     66     1     2     0     1     7                         
    Thanks

  • Pivot Query on Oracle 10g

    Table Structure
    GRP_NR Values
    1 A
    1 B
    2 A
    2 B
    2 C
    3 A
    3 B
    3 C
    N A
    N B
    N C
    I would like to convert the above structure into the following. I prefer to have it as sql query, but open to plsql solution too.
    1 2 3 ..................... N
    A A A ..................... A
    B B B ..................... B
    . C C ..................... C
    I am finding it quite a challenge to do it. especially to make it dynamic.
    I will appreciate your help.

    With model clause.
    Regards salim.
    select GRP_NR, substr( string, 2 ) as string
    from t
    model
    return updated rows
    partition by ( GRP_NR )
    dimension by ( row_number() over (partition by GRP_NR ORDER BY val asc) as position )
    measures ( cast( val as varchar2(1000) ) as string )
    rules
    upsert
    iterate(1000 )
    until ( presentv(string[iteration_number+2],1,0) = 0 )
    ( string[0] = string[0] || ',' || string[iteration_number+1] )
    order by GRP_NR ;
    SQL> with t as (
      2  select 1 GRP_NR, 'A' val from dual union all
      3  select 1 ,'B' val from dual union all
      4  select 2 ,'A' val from dual union all
      5  select 2 ,'B' val from dual union all
      6  select 2 ,'C' val from dual union all
      7  select 3 ,'A' val from dual union all
      8  select 3 ,'B' val from dual union all
      9  select 3 ,'C' val from dual )
    10  select GRP_NR, substr( string, 2 ) as string
    11  from t
    12  model
    13  return updated rows
    14  partition by ( GRP_NR )
    15  dimension by ( row_number() over (partition by GRP_NR ORDER BY val asc) as position )
    16  measures ( cast( val as varchar2(1000) ) as string )
    17  rules
    18  upsert
    19  iterate(1000 )
    20  until ( presentv(string[iteration_number+2],1,0) = 0 )
    21  ( string[0] = string[0] || ',' || string[iteration_number+1] )
    22  order by GRP_NR ;
        GRP_NR STRING
             1 A,B
             2 A,B,C
             3 A,B,C
    SQL>

  • APEX 3.2 -ORACLE 10G - PIVOT QUERY

    Hello, i searched around the forum and i cound't find an answer to this specific matter, although i saw some replies that were close...
    i need to creat a form based on a pivot query. but oracle 10g doesn't support that feature so i hope someone can help me.
    my problem is that the number of columns will be variable. here's an example:
    ORIGINAL TABLE
    NAME     KMS     VEHICLE
    Joe     100     AUDI
    Tom     300     VW
    Mark     150     FORD
    Ann     250     FORD
    Joe     200     VW
    Tom     123     AUDI
    Mark     345     AUDI
    Ann     45     VW
    Joe     6     FORD
    Tom     67     FORD
    Mark     46     VW
    Ann     99     AUDI
    DESIRED RESULT
    Joe     Tom     Mark     Ann     Vehicle
    100     123     345     99     AUDI
    6     67     150     250     FORD
    200     300     46     45     VW
    the new columns will be the values in the old NAME column. BUT these values are variable. today its joe,tom,mark and ann tomorrow it could be silvia, tony,richard,harry , william and jane. this means the usuall replies i saw, using MAX and DECODE will not apply because i never know what values or how many values are in this column. with pivot i can get this done.... how can i do this in oracle 10g? is there a way to creat a ser function Pivot somehow? ideas?
    thanks!
    Mark Pereira
    Edited by: 899716 on Jul 18, 2012 12:02 PM

    This is the Oracle Forms forum. Post your question in the SQL forum.
    Tip: check the latest Oracle Magazine (July/August 2012). There is an article by Tom Kyte about the same question.
    http://www.oracle.com/technetwork/oramag/magazine/home/index.html

  • Errors using DBMS_SQLTUNE Advisors for Oracle 10g

    I get errors trying to tune the below query for Oracle 10g using the DBMS_SQLTUNE advisors.
    It happens when I wrap either a large block of PL/SQL code that uses bind variables or multiple nested subqueries with multiple JOIN conditions in a SELECT query statement that I wish to tune using the 10g SQLTUNE advisors.
    Message was edited by:
    benprusinski

    Hi, I was trying to use the DBMS_SQLTUNE package to tune my sql statements used in the huge procedure. I can successfully create a task and execute it. But when I run report tuning task, I'm always getting error like the one in below example. Two questions I have now.
    1) Is this becuase I'm using bind, but not passing any values?
    2) Can I able to use to this package to tune a procedures instead of sql statement?
    Example output...
    SQL&gt; SELECT DBMS_SQLTUNE.REPORT_TUNING_TASK( 'my_sql_tuning_task3')
    2 FROM DUAL;
    DBMS_SQLTUNE.REPORT_TUNING_TASK('MY_SQL_TUNING_TASK3')
    GENERAL INFORMATION SECTION
    Tuning Task Name : my_sql_tuning_task3
    Tuning Task Owner : SCOTT
    Scope : COMPREHENSIVE
    Time Limit(seconds) : 3000
    Completion Status : COMPLETED
    Started at : 02/26/2009 21:44:41
    Completed at : 02/26/2009 21:44:41
    Number of Errors : 1
    DBMS_SQLTUNE.REPORT_TUNING_TASK('MY_SQL_TUNING_TASK3')
    Schema Name: KPRAVEEN
    SQL ID : 479831s42xj1n
    SQL Text : SELECT a.pdrorn, a.pdrcto, a.pdrlln FROM f4311 a
    WHERE a.pddoco = receiptsrcrec.prdoco AND a.pddcto = :2 AND
    a.pdkcoo = :3 AND a.pdsfxo = :4 AND a.pdlnid = :5
    ERRORS SECTION
    SQL&gt;

Maybe you are looking for

  • How to create a group box in Labview

    I want to make a Group on Items in single window. How to make that one. For ex: In QT this feature is called Groupbox. In Labview I searched this word its not available.      Please help me    Thanks in Advance, Thanks & Regards, Harish. G. Solved! G

  • Moving to a Mac - I'm Ready! - Can you Help?

    I'm getting my new iMac later this week. I'm leaving Windows behind, and I'm trying my best to make sure I don't leave anything important behind and that I make the migration as seemless as possible. So, can anyone assist me in a detailed step-by-ste

  • Flex 3 missing Coldfusion CRUD

    I just installed Flex 3, and I get RDS working fine. I was going to quickly build an app to test using the Coldfusion CRUD Wizard, but it appears to be non-existent in Flex 3? Help! Where did it go? Am I missing something? The only thing I found was

  • My Ipad is deaktivated but I never synchronisised it with Itunes. How do I get it activated again?

    My dad got an Ipad for his birthday and however he managed to enter the code a couple of times and now it is deactivated. He never synchronizised it with his computer or Itunes

  • Payment Allocation

    Dear All, I have to assign in one payment allocation "Payment Advices" and "Other Payments" as well. But this the system doesn't allow and the following error message will be displayed:         "Combining advices of advice collection and other paymen