TDE Table encryption SQL Query performance is very very slow

Hi,
We have done one column encryption for one table using TDE method with no salt option and it got impact the response time of sql query to 32 hours.
Oracle database version is 10.2.0.5
Example like
alter table abc modify (numberx encrypt no salt);
after encryption the SQL execution taking more time and below are the statement for the same.
================================
declare fNumber cardx.numberx%TYPE;
fCount integer :=0;
fserno cardx.serno%TYPE;
fcaccserno cardx.caccserno%TYPE;
ftrxnfeeprofserno cardx.trxnfeeprofserno%TYPE;
fstfinancial cardx.stfinancial%TYPE;
fexpirydate cardx.expirydate%TYPE;
fpreviousexpirydate cardx.previousexpirydate%TYPE;
fexpirydatestatus cardx.expirydatestatus%TYPE;
fblockeddate cardx.blockeddate%TYPE;
fproduct cardx.product%TYPE;
faccstmtsummaryind cardx.accstmtsummaryind%TYPE;
finstitution_id cardx.institution_id%TYPE;
fdefaultaccounttype cardx.defaultaccounttype%TYPE;
flanguagecode cardx.languagecode%TYPE;
froute integer;
begin for i in (select c.numberx from cardx c where c.stgeneral='NORM')
loop select c.serno, c.caccserno, c.trxnfeeprofserno, c.stfinancial, c.expirydate, c.previousexpirydate, c.expirydatestatus, c.blockeddate, c.product, c.accstmtsummaryind, c.institution_id, c.defaultaccounttype, c.languagecode, (select count(*) from caccountrouting ar where ar.cardxserno=c.serno and ar.rtrxntype=ISS_REWARDS.GetRewardTrxnTypeserno) into fserno, fcaccserno, ftrxnfeeprofserno, fstfinancial, fexpirydate, fpreviousexpirydate, fexpirydatestatus, fblockeddate, fproduct, faccstmtsummaryind, finstitution_id, fdefaultaccounttype, flanguagecode, froute from cardx c where c.numberx=i.numberx; fCount := fCount+1; end loop; dbms_output.put_line(fCount); end;
===============================
Any help would be great appreciate
Thanks,
Mohammed.
Edited by: Mohammed Yousuf on Oct 7, 2011 12:47 PM

Still, that's not enough evidence to prove that TDE is indeed the culprit. Can you trace the query before and after enabling the TDE using 10046 and post it here.
Aman....

Similar Messages

  • SQL query performance issues.

    Hi All,
    I worked on the query a month ago and the fix worked for me in test intance but failed in production. Following is the URL for the previous thread.
    SQL query performance issues.
    Following is the tkprof file.
    CURSOR_ID:76  LENGTH:2383  ADDRESS:f6b40ab0  HASH_VALUE:2459471753  OPTIMIZER_GOAL:ALL_ROWS  USER_ID:443 (APPS)
    insert into cos_temp(
    TRX_DATE, DEPT, PRODUCT_LINE, PART_NUMBER,
    CUSTOMER_NUMBER, QUANTITY_SOLD, ORDER_NUMBER,
    INVOICE_NUMBER, EXT_SALES, EXT_COS,
    GROSS_PROFIT, ACCT_DATE,
    SHIPMENT_TYPE,
    FROM_ORGANIZATION_ID,
    FROM_ORGANIZATION_CODE)
    select a.trx_date,
    g.segment5 dept,
    g.segment4 prd,
    m.segment1 part,
    d.customer_number customer,
    b.quantity_invoiced units,
    --       substr(a.sales_order,1,6) order#,
    substr(ltrim(b.interface_line_attribute1),1,10) order#,
    a.trx_number invoice,
    (b.quantity_invoiced * b.unit_selling_price) sales,
    (b.quantity_invoiced * nvl(price.operand,0)) cos,
    (b.quantity_invoiced * b.unit_selling_price) -
    (b.quantity_invoiced * nvl(price.operand,0)) profit,
    to_char(to_date('2010/02/28 00:00:00','yyyy/mm/dd HH24:MI:SS'),'DD-MON-RR') acct_date,
    'DRP',
    l.ship_from_org_id,
    p.organization_code
    from   ra_customers d,
    gl_code_combinations g,
    mtl_system_items m,
    ra_cust_trx_line_gl_dist c,
    ra_customer_trx_lines b,
    ra_customer_trx_all a,
    apps.oe_order_lines l,
    apps.HR_ORGANIZATION_INFORMATION i,
    apps.MTL_INTERCOMPANY_PARAMETERS inter,
    apps.HZ_CUST_SITE_USES_ALL site,
    apps.qp_list_lines_v price,
    apps.mtl_parameters p
    where a.trx_date between to_date('2010/02/01 00:00:00','yyyy/mm/dd HH24:MI:SS')
    and to_date('2010/02/28 00:00:00','yyyy/mm/dd HH24:MI:SS')+0.9999
    and   a.batch_source_id = 1001     -- Sales order shipped other OU
    and   a.complete_flag = 'Y'
    and   a.customer_trx_id = b.customer_trx_id
    and   b.customer_trx_line_id = c.customer_trx_line_id
    and   a.sold_to_customer_id = d.customer_id
    and   b.inventory_item_id = m.inventory_item_id
    and   m.organization_id
         = decode(substr(g.segment4,1,2),'01',5004,'03',5004,
         '02',5003,'00',5001,5002)
    and   nvl(m.item_type,'0') <> '111'
    and   c.code_combination_id = g.code_combination_id+0
    and   l.line_id = b.interface_line_attribute6
    and   i.organization_id = l.ship_from_org_id
    and   p.organization_id = l.ship_from_org_id
    and   i.org_information3 <> '5108'
    and   inter.ship_organization_id = i.org_information3
    and   inter.sell_organization_id = '5108'
    and   inter.customer_site_id = site.site_use_id
    and   site.price_list_id = price.list_header_id
    and   product_attr_value = to_char(m.inventory_item_id)
    call        count       cpu   elapsed         disk        query      current         rows    misses
    Parse           1      0.47      0.56           11          197            0            0         1
    Execute         1   3733.40   3739.40        34893    519962154           11          188         0
    total           2   3733.87   3739.97        34904    519962351           11          188         1
    |         Rows Row Source Operation
    | ------------ ---------------------------------------------------
    |          188 HASH JOIN (cr=519962149 pr=34889 pw=0 time=2607.35)
    |          741 .TABLE ACCESS BY INDEX ROWID QP_PRICING_ATTRIBUTES (cr=519939426 pr=34889 pw=0 time=2457.32)
    |    254644500 ..NESTED LOOPS (cr=519939265 pr=34777 pw=0 time=3819.67)
    |    254643758 ...NESTED LOOPS (cr=8921833 pr=29939 pw=0 time=1274.41)
    |          741 ....NESTED LOOPS (cr=50042 pr=7230 pw=0 time=11.37)
    |          741 .....NESTED LOOPS (cr=48558 pr=7229 pw=0 time=11.35)
    |          741 ......NESTED LOOPS (cr=47815 pr=7223 pw=0 time=11.32)
    |         3237 .......NESTED LOOPS (cr=41339 pr=7223 pw=0 time=12.42)
    |         3237 ........NESTED LOOPS (cr=38100 pr=7223 pw=0 time=12.39)
    |         3237 .........NESTED LOOPS (cr=28296 pr=7139 pw=0 time=12.29)
    |         1027 ..........NESTED LOOPS (cr=17656 pr=4471 pw=0 time=3.81)
    |         1027 ...........NESTED LOOPS (cr=13537 pr=4404 pw=0 time=3.30)
    |          486 ............NESTED LOOPS (cr=10873 pr=4240 pw=0 time=0.04)
    |          486 .............NESTED LOOPS (cr=10385 pr=4240 pw=0 time=0.03)
    |          486 ..............TABLE ACCESS BY INDEX ROWID RA_CUSTOMER_TRX_ALL (cr=9411 pr=4240 pw=0 time=0.02)
    |        75253 ...............INDEX RANGE SCAN RA_CUSTOMER_TRX_N5 (cr=403 pr=285 pw=0 time=0.38)
    |          486 ..............TABLE ACCESS BY INDEX ROWID HZ_CUST_ACCOUNTS (cr=974 pr=0 pw=0 time=0.01)
    |          486 ...............INDEX UNIQUE SCAN HZ_CUST_ACCOUNTS_U1 (cr=488 pr=0 pw=0 time=0.01)
    |          486 .............INDEX UNIQUE SCAN HZ_PARTIES_U1 (cr=488 pr=0 pw=0 time=0.01)
    |         1027 ............TABLE ACCESS BY INDEX ROWID RA_CUSTOMER_TRX_LINES_ALL (cr=2664 pr=164 pw=0 time=1.95)
    |         2063 .............INDEX RANGE SCAN RA_CUSTOMER_TRX_LINES_N2 (cr=1474 pr=28 pw=0 time=0.22)
    |         1027 ...........TABLE ACCESS BY INDEX ROWID RA_CUST_TRX_LINE_GL_DIST_ALL (cr=4119 pr=67 pw=0 time=0.54)
    |         1027 ............INDEX RANGE SCAN RA_CUST_TRX_LINE_GL_DIST_N1 (cr=3092 pr=31 pw=0 time=0.20)
    |         3237 ..........TABLE ACCESS BY INDEX ROWID MTL_SYSTEM_ITEMS_B (cr=10640 pr=2668 pw=0 time=15.35)
    |         3237 ...........INDEX RANGE SCAN MTL_SYSTEM_ITEMS_B_U1 (cr=2062 pr=40 pw=0 time=0.33)
    |         3237 .........TABLE ACCESS BY INDEX ROWID OE_ORDER_LINES_ALL (cr=9804 pr=84 pw=0 time=0.77)
    |         3237 ..........INDEX UNIQUE SCAN OE_ORDER_LINES_U1 (cr=6476 pr=47 pw=0 time=0.43)
    |         3237 ........TABLE ACCESS BY INDEX ROWID MTL_PARAMETERS (cr=3239 pr=0 pw=0 time=0.04)
    |         3237 .........INDEX UNIQUE SCAN MTL_PARAMETERS_U1 (cr=2 pr=0 pw=0 time=0.01)
    |          741 .......TABLE ACCESS BY INDEX ROWID HR_ORGANIZATION_INFORMATION (cr=6476 pr=0 pw=0 time=0.10)
    |         6474 ........INDEX RANGE SCAN HR_ORGANIZATION_INFORMATIO_FK2 (cr=3239 pr=0 pw=0 time=0.03)Please help.
    Regards
    Ashish

    |    254644500 ..NESTED LOOPS (cr=519939265 pr=34777 pw=0 time=3819.67)
    |    254643758 ...NESTED LOOPS (cr=8921833 pr=29939 pw=0 time=1274.41)There is no way the optimizer should choose to process that many rows using nested loops.
    Either the statistics are not up to date, the data values are skewed or you have some optimizer parameter set to none default to force index access.
    Please post explain plan and optimizer* parameter settings.

  • How does Index fragmentation and statistics affect the sql query performance

    Hi,
    How does Index fragmentation and statistics affect the sql query performance
    Thanks
    Shashikala
    Shashikala

    How does Index fragmentation and statistics affect the sql query performance
    Very simple answer, outdated statistics will lead optimizer to create bad plans which in turn will require more resources and this will impact performance. If index is fragmented ( mainly clustered index,holds true for Non clustred as well) time spent in finding
    the value will be more as query would have to search fragmented index to look for data, additional spaces will increase search time.
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers
    My TechNet Wiki Articles

  • Having more LTSs in logical dimension table hit the query performance?

    Hi,
    We have a logical table having around 19 LTSs. Having more LTSs in logical dimension table hit the query performance?
    Thanks,
    Anilesh

    Hi Anilesh,
    Its kind of both YES and NO. Here is why...
    NO:
    LTS are supposed to give BI Server an optimistic and logical way to retrieve the data. So, having more Optimistic LTS might help the BI Server with some good options tailored to a variety of analysis requests.
    YES:
    Many times, we have to bring in multiple physical tables as a part of single LTS (Mostly when the physical model is a snowflake) which might cause performance issues. Say there is a LTS with two tables "A" and "B", but for a ad-hoc analysis just on columns in "A", the query would still include the join with table "B" if this LTS is being used. We might want to avoid this kind of situations with multiple LTS each for a table and one for both of them.
    Hope this helps.
    Thank you,
    Dhar

  • T-SQL query performance (CLR func + webservice)

    Hi guys
    I have CLR function which accepts address as a parameter, calls geocoding webservice and returns some information (coordinates etc.)
    I run SQL query
    SELECT *FROM T CROSS APPLY CLR_Func(T.Address)F
    Table contains 8 million records and obviously query runs very slow.
    Do you know any nice way to improve performance in this situation?
    Thank you,
    Max

    No WHERE condition?  SQL Server will call the function 8 million times ....
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • SQL query performance question

    So I had this long query that looked like this:
    SELECT a.BEGIN_DATE, a.END_DATE, a.DEAL_KEY, (select name from ideal dd where a.deal_key = dd.deal_key) DEALNAME, a.deal_term_key
    FROM
    ideal d, ideal_term a,( select deal_key, deal_term_key, max(createdOn) maxdate    from Ideal_term B
    where createdOn <= '03-OCT-12 10.03.00 AM' group by deal_key, deal_term_key ) B
    WHERE  a.begin_date <= '20-MAR-09 01.01.00 AM'
    *     and a.end_date >= '19-MAR-09 01.00.00 AM'*
    *     and A.deal_key = b.deal_key*
    *     and A.deal_term_key = b.deal_term_key*
    *     and     a.createdOn = b.maxdate*
    *     and d.deal_key = a.deal_key*
    *     and d.name like 'MVPP1 B'*
    order by
    *     a.begin_date, a.deal_key, a.deal_term_key;*
    This performed very poorly for a record in one of the tables that has 43,000+ revisions. It took about 1 minute and 40 seconds. I asked the database guy at my company for help with it and he re-wrote it like so:
    SELECT a.BEGIN_DATE, a.END_DATE, a.DEAL_KEY, (select name from ideal dd where a.deal_key = dd.deal_key) DEALNAME, a.deal_term_key
    FROM ideal d
    INNER JOIN (SELECT deal_key,
    deal_term_key,
    MAX(createdOn) maxdate
    FROM Ideal_term B2
    WHERE '03-OCT-12 10.03.00 AM' >= createdOn
    GROUP BY deal_key, deal_term_key) B1
    ON d.deal_key = B1.deal_key
    INNER JOIN ideal_term a
    ON B1.deal_key = A.deal_key
    AND B1.deal_term_key = A.deal_term_key
    AND B1.maxdate = a.createdOn
    AND d.deal_key = a.deal_key + 0
    WHERE a.begin_date <= '20-MAR-09 01.01.00 AM'
    AND a.end_date >= '19-MAR-09 01.00.00 AM'
    AND d.name LIKE 'MVPP1 B'
    ORDER BY a.begin_date, a.deal_key, a.deal_term_key
    this works much better, it only takes 0.13 seconds. I've bee trying to figure out why exaclty his version performs so much better. His only epxlanation was that the "+ 0" in the WHERE clause prevented Oracle from using an index for that column which created a bad plan initially.
    I think there has to be more to it than that though. Can someone give me a detailed explanation of why the second version of the query performed so much faster.
    Thanks.
    Edited by: su**** on Oct 10, 2012 1:31 PM

    I used Autotrace in SQL developer. Is that sufficient? Here is the Autotrace and Explain for the slow query:
    and for the fast query:
    I said that I thought there was more to it because when my team members and I looked at the re-worked query the database guy sent us, our initial thoughts were that in the slow query some of the tables didn't have joins and because of that the query formed a Cartesian product and this resulted in a huge 43,000+ rows matrix.
    In his version all tables had joins properly defined and in addition he had that +0 which told it to ignore the index for the attribute deal_key of table ideal_term. I spoke with the database guy today and he confirmed our theory.

  • SQL Query Performance

    Hi There,
    We have a sql query that runs between 2 databases on the same machine, the sql takes about 2 mins and returns about 6400 rows. When the process started running we used to see results in about 13 secs, now it's taking almost 2 mins for the same data set. We have updated the stats (table and index) but to no use. I've been trying to get the execution plan to see if there is anything abnormal going on but as the core of the sql is done remotely, we haven't been able to get much out of it.
    Here is the sql:
    SELECT  
    --/*+ DRIVING_SITE(var) ALL_ROWS */
             ventity_id, ar_action_performed, action_date,
             'ventity_ar' ar_tab
        FROM (SELECT var.ventity_id, var.ar_action_performed, var.action_date,
                     var.familyname_id, var.status, var.isprotected,
                     var.dateofbirth, var.gender, var.sindigits,
                     LAG (var.familyname_id) OVER (PARTITION BY var.ventity_id ORDER BY action_date)
                                                                lag_familyname_id,
                     LAG (var.status) OVER (PARTITION BY var.ventity_id ORDER BY action_date)
                                                                       lag_status,
                     LAG (var.isprotected) OVER (PARTITION BY var.ventity_id ORDER BY action_date)
                                                                  lag_isprotected,
                     LAG (var.dateofbirth) OVER (PARTITION BY var.ventity_id ORDER BY action_date)
                                                                  lag_dateofbirth,
                     LAG (var.gender) OVER (PARTITION BY var.ventity_id ORDER BY action_date)
                                                                       lag_gender,
                     LAG (var.sindigits) OVER (PARTITION BY var.ventity_id ORDER BY action_date)
                                                                    lag_sindigits
                FROM cpp_schema.ventity_ar@CdpP var,
                     -- reduce the set to ventity_id that had a change within the time frame,
                     -- and filter out RETRIEVEs as they do not signal change
                     (SELECT DISTINCT ventity_id
                                 FROM cpp_schema.ventity_ar@CdpP
                                WHERE action_date BETWEEN '01-MAR-10' AND '10-APR-10'
                                  AND ar_action_performed <> 'RTRV') m
               WHERE var.action_date <= '10-APR-10'
                 AND var.ventity_id = m.ventity_id
                 AND var.ar_action_performed <> 'RTRV') mm
       WHERE action_date BETWEEN '01-MAR-10' AND '10-APR-10'
         -- most of the columns from the data table allow nulls
         AND (   (NVL (familyname_id, 0) <> NVL (lag_familyname_id, 0))
              OR (NVL (status, 'x') <> NVL (lag_status, 'x'))
              OR (NVL (isprotected, 2) <> NVL (lag_isprotected, 2))
              OR (NVL (dateofbirth, TO_DATE ('15000101', 'yyyymmdd')) <>
                           NVL (lag_dateofbirth, TO_DATE ('15000101', 'yyyymmdd'))
              OR (NVL (gender, 'x') <> NVL (lag_gender, 'x'))
              OR (NVL (sindigits, 'x') <> NVL (lag_sindigits, 'x'))
    ORDER BY ventity_id, action_date DESC
    6401 rows selected.
    Elapsed: 00:01:47.03
    Execution Plan
    Plan hash value: 3953446945
    | Id  | Operation        | Name | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     | Inst   |IN-OUT|
    |   0 | SELECT STATEMENT |      |    12M|  1575M|       |   661K  (1)| 02:12:22 |        |      |
    |   1 |  SORT ORDER BY   |      |    12M|  1575M|  2041M|   661K  (1)| 02:12:22 |        |      |
    |*  2 |   VIEW           |      |    12M|  1575M|       |   291K  (2)| 00:58:13 |        |      |
    |   3 |    REMOTE        |      |       |       |       |            |          | CCP01  | R->S |
       2 - filter("action_date">='01_MAR-10' AND "action_date"<='10-APR-10' AND
                  (NVL("FAMILYNAME_id",0)<>NVL("LAG_FAMILYNAME_id",0) OR
                  NVL("STATUS",'x')<>NVL("LAG_STATUS",'x') OR NVL("ISPROTECTED",2)<>NVL("LAG_ISPROTECTED",2
                  ) OR NVL("DATEOFBIRTH",TO_DATE(' 1500-01-01 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss'))<>NVL("LAG_DATEOFBIRTH",TO_DATE(' 1500-01-01 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss')) OR NVL("GENDER",'x')<>NVL("LAG_GENDER",'x') OR
                  NVL("SINDIGITS",'x')<>NVL("LAG_SINDIGITS",'x')))
    Remote SQL Information (identified by operation id):
       3 - EXPLAIN PLAN SET STATEMENT_ID='PLUS4294967295' INTO PLAN_TABLE@! FOR SELECT
           "A2"."ventity_id","A2"."AR_ACTION_PERFORMED","A2"."action_date","A2"."FAMILYNAME_id","A2"
           ."STATUS","A2"."ISPROTECTED","A2"."DATEOFBIRTH","A2"."GENDER","A2"."SINDIGITS",DECODE(COU
           NT(*) OVER ( PARTITION BY "A2"."ventity_id" ORDER BY "A2"."action_date" ROWS  BETWEEN 1
           PRECEDING  AND 1 PRECEDING ),1,FIRST_VALUE("A2"."FAMILYNAME_id") OVER ( PARTITION BY
           "A2"."ventity_id" ORDER BY "A2"."action_date" ROWS  BETWEEN 1 PRECEDING  AND 1 PRECEDING
           ),NULL),DECODE(COUNT(*) OVER ( PARTITION BY "A2"."ventity_id" ORDER BY
           "A2"."action_date" ROWS  BETWEEN 1 PRECEDING  AND 1 PRECEDING ),1,FIRST_VALUE("A2"."STATUS")
           OVER ( PARTITION BY "A2"."ventity_id" ORDER BY "A2"."action_date" ROWS  BETWEEN 1
           PRECEDING  AND 1 PRECEDING ),NULL),DECODE(COUNT(*) OVER ( PARTITION BY
           "A2"."ventity_id" ORDER BY "A2"."action_date" ROWS  BETWEEN 1 PRECEDING  AND 1 PRECEDING
           ),1,FIRST_VALUE("A2"."ISPROTECTED") OVER ( PARTITION BY "A2"."ventity_id" ORDER BY
           "A2"."action_date" ROWS  BETWEEN 1 PRECEDING  AND 1 PRECEDING ),NULL),DECODE(COUNT(*) OVER (
           PARTITION BY "A2"."ventity_id" ORDER BY "A2"."action_date" ROWS  BETWEEN 1 PRECEDING
           AND 1 PRECEDING ),1,FIRST_VALUE("A2"."DATEOFBIRTH") OVER ( PARTITION BY
           "A2"."ventity_id" ORDER BY "A2"."action_date" ROWS  BETWEEN 1 PRECEDING  AND 1 PRECEDING
           ),NULL),DECODE(COUNT(*) OVER ( PARTITION BY "A2"."ventity_id" ORDER BY
           "A2"."action_date" ROWS  BETWEEN 1 PRECEDING  AND 1 PRECEDING ),1,FIRST_VALUE("A2"."GENDER")
           OVER ( PARTITION BY "A2"."ventity_id" ORDER BY "A2"."action_date" ROWS  BETWEEN 1
           PRECEDING  AND 1 PRECEDING ),NULL),DECODE(COUNT(*) OVER ( PARTITION BY
           "A2"."ventity_id" ORDER BY "A2"."action_date" ROWS  BETWEEN 1 PRECEDING  AND 1 PRECEDING
           ),1,FIRST_VALUE("A2"."SINDIGITS") OVER ( PARTITION BY "A2"."ventity_id" ORDER BY
           "A2"."action_date" ROWS  BETWEEN 1 PRECEDING  AND 1 PRECEDING ),NULL) FROM
           "CPP_SCHEMA"."ventity_AR" "A2", (SELECT DISTINCT "A3"."ventity_id"
           "ventity_id" FROM "CPP_SCHEMA"."ventity_AR" "A3" WHERE
           "A3"."action_date">='01_MAR-10' AND "A3"."action_date"<='10-APR-10' AND
           "A3"."AR_ACTION_PERFORMED"<>'RETRIEVE' AND TO_DATE('01_MAR-10')<=TO_DATE('10-APR-10'))
           "A1" WHERE "A2"."action_date"<='10-APR-10' AND "A2"."ventity_id"="A1"."ventity_id"
           AND "A2"."AR_ACTION_PERFORMED"<>'RETRIEVE' (accessing 'EBCP01.EBC.GOV.BC.CA' )Your advise and/or help is highly appreciated.
    THanks
    Edited by: rsar001 on Apr 20, 2010 6:57 AM

    Maybe I'm missing something but this subquery seems inefficient:
    SELECT var.ventity_id, var.ar_action_performed, var.action_date,
                     var.familyname_id, var.status, var.isprotected,
                     var.dateofbirth, var.gender, var.sindigits,
                     LAG (var.familyname_id) OVER (PARTITION BY var.ventity_id ORDER BY action_date)
                                                                lag_familyname_id,
                     LAG (var.status) OVER (PARTITION BY var.ventity_id ORDER BY action_date)
                                                                       lag_status,
                     LAG (var.isprotected) OVER (PARTITION BY var.ventity_id ORDER BY action_date)
                                                                  lag_isprotected,
                     LAG (var.dateofbirth) OVER (PARTITION BY var.ventity_id ORDER BY action_date)
                                                                  lag_dateofbirth,
                     LAG (var.gender) OVER (PARTITION BY var.ventity_id ORDER BY action_date)
                                                                       lag_gender,
                     LAG (var.sindigits) OVER (PARTITION BY var.ventity_id ORDER BY action_date)
                                                                    lag_sindigits
                FROM cpp_schema.ventity_ar@CdpP var,
                     -- reduce the set to ventity_id that had a change within the time frame,
                     -- and filter out RETRIEVEs as they do not signal change
                     (SELECT DISTINCT ventity_id
                                 FROM cpp_schema.ventity_ar@CdpP
                                WHERE action_date BETWEEN '01-MAR-10' AND '10-APR-10'
                                  AND ar_action_performed <> 'RTRV') m
               WHERE var.action_date <= '10-APR-10'
                 AND var.ventity_id = m.ventity_id
                 AND var.ar_action_performed != 'RTRV'I don't think accessing the VENTITY_AR table twice is helping you here. The comments looks like you want to restrict the set of VENTITY_IDs but if you look at the plan it is not happening. The plan is reading them from the index and joining against the full VENTITY_AR table anyways. I recommend you consolidate it into something like this:
    SELECT  var.ventity_id
    ,       var.ar_action_performed
    ,       var.action_date
    ,       var.familyname_id
    ,       var.status
    ,       var.isprotected
    ,       var.dateofbirth
    ,       var.gender
    ,       var.sindigits
    ,       LAG (var.familyname_id) OVER (PARTITION BY var.ventity_id ORDER BY action_date)         AS lag_familyname_id
    ,       LAG (var.status) OVER (PARTITION BY var.ventity_id ORDER BY action_date)                AS lag_status
    ,       LAG (var.isprotected) OVER (PARTITION BY var.ventity_id ORDER BY action_date)           AS lag_isprotected
    ,       LAG (var.dateofbirth) OVER (PARTITION BY var.ventity_id ORDER BY action_date)           AS lag_dateofbirth
    ,       LAG (var.gender) OVER (PARTITION BY var.ventity_id ORDER BY action_date)                AS lag_gender
    ,       LAG (var.sindigits) OVER (PARTITION BY var.ventity_id ORDER BY action_date)             AS lag_sindigits
    FROM    cpp_schema.ventity_ar@CdpP var
    WHERE   var.action_date BETWEEN TO_DATE('01-MAR-10','DD-MON-YY') AND TO_DATE('10-APR-10','DD-MON-YY')
    AND     var.ar_action_performed != 'RTRV'It may then be useful to put an index on (ACTION_DATE,AR_ACTION_PERFORMED) if one doesn't already exist.
    *::EDIT::*
    I noticed the large amount of NVL calls in your outer query. These NVLs could possibly be eliminated if you use the optional second and third arguments of the LAG analytical function. I'm not sure if this would improve performance but it may make the query more readable and maintainable.
    HTH!
    Edited by: Centinul on Apr 20, 2010 10:50 AM

  • How to retrive the blob data from a table using sql query

    Hi gurus,
    I have a table which has " BLOB "content in a column .I want to view the data From BLOB column using sql query .It would be helpfull If some one share their idea.
    Regards,
    vardhani.

    You can use data templates.
    See this: http://blogs.oracle.com/xmlpublisher/entry/blob_clob_raw_and_looooong
    http://blogs.oracle.com/xmlpublisher/entry/inserting_blobs_into_your_repo
    Thanks,
    Bipuser

  • SQL Query Performance needed.

    Hi All,
       I am getting performance issue with my below sql query. When I fired it, It is taking 823.438 seconds, but when I ran query in, it is taking 8.578 seconds, and query after in   is taking 7.579 seconds.
    SELECT BAL.L_ID, BAL.L_TYPE, BAL.L_NAME, BAL.NATURAL_ACCOUNT,
     BAL.LOCATION, BAL.PRODUCT, BAL.INTERCOMPANY, BAL.FUTURE1, BAL.FUTURE2, BAL.CURRENCY, BAL.AMOUNT_PTD, BAL.AMOUNT_YTD, BAL.CREATION_DATE,
     BAL.CREATED_BY, BAL.LAST_UPDATE_DATE, BAL.LAST_UPDATED_BY, BAL.STATUS, BAL.ANET_STATUS, BAL.COG_STATUS, BAL.comb_id, BAL.MESSAGE,
     SEG.SEGMENT_DESCRIPTION  FROM ACC_SEGMENTS_V_TST SEG , ACC_BALANCE_STG BAL where BAL.NATURAL_ACCOUNT = SEG.SEGMENT_VALUE AND SEG.SEGMENT_COLUMN = 'SEGMENT99' AND BAL.ACCOUNTING_PERIOD = 'MAY-10' and BAL.comb_id
    in  
    (select comb_id from
     (select comb_id, rownum r from
      (select distinct(comb_id),LAST_UPDATE_DATE from ACC_BALANCE_STG where accounting_period='MAY-10' order by LAST_UPDATE_DATE )    
         where rownum <=100)  where r >0)
    Please help me in fine tuning above. I am using Oracle 10g database. There are total of 8000 records. Let me know if any other info required.
    Thanks in advance.

    In recent versions of Oracle an EXISTS predicate should produce the same execution plan as the corresponding IN clause.
    Follow the advice in the tuning threads as suggested by SomeoneElse.
    It looks to me like you could avoid the double pass on ACC_BALANCE_STG by using an analytical function like ROW_NUMBER() and then joining to ACC_SEGMENTS_V_TST SEG, maybe using subquery refactoring to make it look nicer.
    e.g. something like (untested)
    WITH subq_bal as
        ((SELECT *
          FROM (SELECT BAL.L_ID, BAL.L_TYPE, BAL.L_NAME, BAL.NATURAL_ACCOUNT,
                 BAL.LOCATION, BAL.PRODUCT, BAL.INTERCOMPANY, BAL.FUTURE1, BAL.FUTURE2,
                 BAL.CURRENCY, BAL.AMOUNT_PTD, BAL.AMOUNT_YTD, BAL.CREATION_DATE,
                 BAL.CREATED_BY, BAL.LAST_UPDATE_DATE, BAL.LAST_UPDATED_BY, BAL.STATUS, BAL.ANET_STATUS,
                 BAL.COG_STATUS, BAL.comb_id, BAL.MESSAGE,
                 ROW_NUMBER() OVER (ORDER BY LAST_UPDATE_DATE) rn
                 FROM   acc_balance_stg
                 WHERE  accounting_period='MAY-10')
          WHERE rn <= 100)
    SELECT *
    FROM   subq_bal bal
    ,      acc_Segments_v_tst seg
    where  BAL.NATURAL_ACCOUNT = SEG.SEGMENT_VALUE
    AND    SEG.SEGMENT_COLUMN = 'SEGMENT99';However, the parentheses you use around comb_id make me question what your intention is here in the subquery?
    Do you have multiple rows in ACC_BALANCE_STG for the same comb_id and last_update_date?
    If so you may want to do a MAX on last_update_date, group by comb_id before doing the analytic restriction.
    Edited by: DomBrooks on Jun 16, 2010 5:56 PM

  • Sql query using LIKE is very slow

    Hi,
    I am running SQL query with LIKE on two table with more than two million records on oracle 10g and sun solaris OS. Does anybody have any idea or alternative to improve this query?
    it will never use index because i m using LIKE '%xyz%'. I Have posted query below
    PROCEDURE order_search
    v_search_type_in IN VARCHAR2
    ,v_search_value1_in IN VARCHAR2 DEFAULT 'NONE'
    ,v_search_value2_in IN VARCHAR2 DEFAULT 'NONE'
    ,v_group_id_in IN bcf_groups.group_id%TYPE DEFAULT 0
    ,v_open_in IN NUMBER DEFAULT 0
    ,v_requested_in IN NUMBER DEFAULT 0
    ,v_cancelled_in IN NUMBER DEFAULT 0
    ,v_closed_in IN NUMBER DEFAULT 0
    ,v_employee_id_in IN sxweb00.customer.customer_id%TYPE DEFAULT 0
    ,outcursor IN OUT FulfillmentCurType
    IS
    v_status_code NUMBER;
    v_upper_search_value1 VARCHAR2(500);
    v_lower_search_value1 VARCHAR2(500);
    v_open_status VARCHAR2(10);
    v_closed_status VARCHAR2(10);
    v_cancelled_status VARCHAR2(10);
    v_requested_status VARCHAR2(10);
    v_group_for_search bcf_groups.group_id%TYPE;
    v_sql_select VARCHAR2(4000);
    v_sql_from VARCHAR2(4000);
    v_sql_where VARCHAR2(4000);
    v_sql_order_by VARCHAR2(4000);
    v_group_where VARCHAR2(100);
    v_status_where VARCHAR2(500);
    BEGIN
    IF v_open_in = 1 THEN
    v_open_status := 'OPEN';
    END IF;
    IF v_closed_in = 1 THEN
    v_closed_status := 'CLOSED';
    END IF;
    IF v_cancelled_in = 1 THEN
    v_cancelled_status := 'CANCELLED';
    END IF;
    IF v_requested_in = 1 THEN
    v_requested_status := 'REQUESTED';
    END IF;
    IF UPPER(v_search_type_in) = 'GROUP'
    THEN
    v_group_for_search := v_search_value1_in;
    ELSE
    v_group_for_search := v_group_id_in;
    END IF;
    -- This is the select statement used for all search types
    v_sql_select := ' '
    || 'po.order_id order_id '
    || ',decode('||v_group_id_in||',4,substr(bcf_locator.get_first_location(po.order_id,'||v_group_id_in||'),3),null) first_location '
    || ',TO_CHAR(po.order_date, ''mm/dd/yyyy'') order_date '
    || ',' || v_group_for_search || ' group_id '
    || ',TRIM(TO_CHAR(bcf_fulfillment.get_shipping_total(po.order_id,' || v_group_for_search || ') + bcf_fulfillment.get_tax_total(po.order_id,' || v_group_for_search || ') + bcf_fulfillment.get_subtotal(po.order_id,' || v_group_for_search || ') ,''$999,999,999,999,999,990.99'')) total '
    || ',bcf_fulfillment.get_billing_name (po.customer_id) billing_name '
    || ',bcf_fulfillment.get_open_and_assigned_count(po.order_id,' || v_group_for_search || ') open_and_assigned_count '
    || ',bcf_fulfillment.get_divisions(po.order_id,' || v_group_for_search || ') divisions '
    || ',bcf_fulfillment.get_division_count (po.order_id,' || v_group_for_search || ' ) division_count '
    || ',bcf_fulfillment.get_picker_list (po.order_id,' || v_group_for_search || ') picker_name '
    || ',bcf_fulfillment.get_picker_count (po.order_id,' || v_group_for_search || ') picker_count '
    || ',bcf_fulfillment.get_order_status(po.order_id,' || v_group_for_search || ') order_status '
    || ',po.customer_id customer_id '
    -- IF there is only one unique picker then that means there are no unassigned or NULL pickers
    -- therefore by default the checkbox should not be selected else the count picker_count is
    -- 0 or > 1 meaning that at least one line item has an unassigned employee_id and by default
    -- the checkbox should be selected
    || ',DECODE(bcf_fulfillment.get_picker_count(po.order_id,' || v_group_for_search || '),1 ,0,1) print_cb '
    || ',bcf_fulfillment.get_fulfillment_codes(po.order_id,' || v_group_for_search || ') fulfillment_types '
    || ',bcf_fulfillment.has_group_been_reassigned(po.order_id,' || v_group_for_search || ') group_reassigned_flag '
    || ',bcf_fulfillment.get_chain_codes(po.order_id,' || v_group_for_search || ') chain_codes '
    || ',po.status_id order_status_id '
    || ',bcf_fulfillment.get_viewed_by_picker_flag(po.order_id,' || v_group_for_search || ') viewed_by_picker_flag '
    || ',bcf_fulfillment.get_picker_list (po.order_id,' || v_group_for_search || ', ''N'') pickers_without_unassigned '
    || ',bcf_fulfillment.get_group_list (po.order_id) group_list '
    || ',bcf_fulfillment.get_line_item_count(po.order_id,' || v_group_for_search || ') line_item_count '
    || ',bcf_fulfillment.get_shipping_priority(po.order_id,' || v_group_for_search || ') shipping_priority'
    -- Anna wants all users to know and always wants to know no matter what the status of the auth or order
    || ',(SELECT decode(count(*),0,''N'',''Y'') FROM bcf_payment WHERE ics_rflag = ''DAVSNO'' AND order_id = po.order_id AND status_code IN (''ATH2'',''FUL2'',''CPT0'',''CPT2'')) avs_failed'
    || ',trunc(po.order_date) date_for_sort'
    -- When we need to look at all orders then the v_group_for_search will be zero i.e. customer service rep
    IF v_group_for_search = 0 THEN
    -- This is the core tables used by most search types
    v_sql_from := ' '
    || 'FROM product_order po'
    -- || ',bcf_lookup lu'
    -- This is the core table join needed for most search types
    v_sql_where := ' '
    || 'WHERE 1 = 1 '
    -- No orders will be looked at for fulfillment purposes that occurred before the minimum
    -- shipping cost functionality was added
    -- || 'AND po.order_date >= lu.implement_date '
    || 'AND po.order_date >= (SELECT min(implement_date) FROM bcf_lookup) '
    || 'AND po.submitted_flag = 1 '
    || 'AND po.channel_code = ''BCF'' '
    -- When we are looking at all orders then we are not going to restrict it by group
    v_group_where := ' ';
    -- This is used where the search type requires searching by the Open, Closed, and Cancelled status.
    -- We are binding the three status variables so that they can be cached in Oracle and not need to be parsed after
    -- the first search of a search type is done.
    v_status_where := ' '
    || 'AND bcf_fulfillment.get_order_status(po.order_id,' || v_group_for_search|| ') '
    || 'IN (:v_open_status, :v_requested_status, :v_cancelled_status, :v_closed_status) '
    ELSE
    -- This is the core tables used by most search types
    v_sql_from := ' '
    || 'FROM product_order po'
    || ',bcf_product_order_groups pog '
    -- This is the core table join needed for most search types
    v_sql_where := ' '
    || 'WHERE 1 = 1 '
    || 'AND po.order_id = pog.order_id '
    || 'AND po.channel_code = ''BCF'' '
    -- This is used only where the search type requires searching by a group.
    v_group_where := ' '
    || 'AND pog.group_id = ' || v_group_for_search
    -- This is used where the search type requires searching by the Open, Closed, and Cancelled status.
    -- We are binding the three status variables so that they can be cached in Oracle and not need to be parsed after
    -- the first search of a search type is done.
    v_status_where := ' '
    || 'AND pog.dn_status IN (:v_open_status, :v_requested_status, :v_cancelled_status, :v_closed_status) '
    END IF;
    -- If an employee_id is provided then we need to add in a where clause so that only orders that belong to that
    -- employee are pulled
    IF v_employee_id_in > 0
    THEN
    v_sql_where := v_sql_where
    || 'AND pog.dn_employee_id = ' || TO_CHAR(v_employee_id_in) || ' '
    END IF;
    IF v_group_id_in = get_group_fulfillment_center1
    THEN
    v_sql_order_by := 'ORDER BY '
    || 'bcf_fulfillment.get_division_count (po.order_id,' || v_group_for_search || ') '
    || ',bcf_fulfillment.get_divisions(po.order_id,' || v_group_for_search || ') '
    || ',po.order_id '
    ELSIF v_group_id_in = c_GROUP_FULFILLMENT_CENTER_212
    THEN
    v_sql_order_by := 'ORDER BY '
    || 'bcf_fulfillment.get_shipping_priority(po.order_id,' || v_group_for_search || ') DESC'
    || ',TRUNC(po.order_date)'
    || ',bcf_fulfillment.get_line_item_count(po.order_id,' || v_group_for_search || ')'
    || ',decode('||v_group_id_in||',4,substr(bcf_locator.get_first_location(po.order_id,'||v_group_id_in||'),3),null)'
    || ',po.order_id'
    ELSE
    v_sql_order_by := 'ORDER BY '
    || ' bcf_fulfillment.get_shipping_priority(po.order_id,' || v_group_for_search || ') DESC'
    || ',chain_codes DESC'
    || ',po.order_id '
    END IF;
    IF UPPER(v_search_type_in) = 'ORDERNUMBER'
    THEN
    v_sql_where := v_sql_where || v_group_where
    || 'AND po.order_id = :v_search_value1_in '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where
    USING v_search_value1_in;
    ELSIF UPPER(v_search_type_in) = 'STATUSONLY'
    THEN
    v_sql_where := v_sql_where || v_group_where || v_status_where
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_open_status, v_requested_status, v_cancelled_status, v_closed_status;
    ELSIF UPPER(v_search_type_in) = 'BILLINGNAME'
    THEN
    v_upper_search_value1 := UPPER(v_search_value1_in);
    v_sql_where := v_sql_where || ' ' || v_group_where
    || 'AND po.upper_billing_name LIKE ''%'' || :v_upper_search_value1 || ''%'' '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_upper_search_value1;
    ELSIF UPPER(v_search_type_in) = 'GROUP'
    THEN
    IF v_search_value1_in = '0' -- Unassigned
    THEN
    v_sql_from := v_sql_from || ' ,product_order_detail_actv_v pod ';
    v_sql_where := v_sql_where || ' ' || v_status_where
    || 'AND po.order_id = pod.order_id '
    || 'AND pod.group_id IS NULL '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT DISTINCT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_open_status, v_requested_status, v_cancelled_status, v_closed_status;
    ELSE
    v_sql_where := v_sql_where || ' ' || v_status_where
    || 'AND pog.group_id = :v_group_for_search '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_open_status, v_requested_status, v_cancelled_status, v_closed_status, v_group_for_search;
    END IF;
    ELSIF UPPER(v_search_type_in) = 'SHIPPINGNAME'
    THEN
    v_upper_search_value1 := UPPER(v_search_value1_in);
    v_sql_where := v_sql_where || ' ' || v_group_where
    || 'AND po.upper_shipping_name LIKE ''%'' || :v_upper_search_value1 || ''%'' '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_upper_search_value1;
    ELSIF UPPER(v_search_type_in) = 'USERNAME'
    THEN
    v_lower_search_value1 := LOWER(v_search_value1_in);
    v_sql_from := v_sql_from || ' ,sxweb01.customer c ';
    v_sql_where := v_sql_where || ' ' || v_group_where
    || 'AND po.customer_id = c.customer_id '
    || 'AND c.username LIKE ''%'' || :v_lower_search_value1 || ''%'' '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_lower_search_value1;
    ELSIF UPPER(v_search_type_in) = 'BILLINGADDRESS1'
    THEN
    v_upper_search_value1 := UPPER(v_search_value1_in);
    v_sql_from := v_sql_from || ' ,order_payment op '
    || ' ,credit_card cc '
    || ' ,om_address oma '
    v_sql_where := v_sql_where || ' ' || v_group_where
    || 'AND po.order_id = op.business_object_id '
    || 'AND op.business_object_type = ''ORDR'' '
    || 'AND op.payment_method = ''CRCD'' '
    || 'AND op.payment_method_id = cc.credit_card_id '
    || 'AND cc.address_id = oma.address_id '
    || 'AND UPPER(oma.address1) LIKE ''%'' || :v_upper_search_value1 || ''%'' '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_upper_search_value1;
    ELSIF UPPER(v_search_type_in) = 'SHIPPINGADDRESS1'
    THEN
    v_upper_search_value1 := UPPER(v_search_value1_in);
    v_sql_from := v_sql_from || ' ,shipping_info si '
    || ' ,om_address oma '
    v_sql_where := v_sql_where || ' ' || v_group_where
    || 'AND po.order_id = si.order_id '
    || 'AND si.ship_to_address_id = oma.address_id '
    || 'AND UPPER(oma.address1) LIKE ''%'' || :v_upper_search_value1 || ''%'' '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_upper_search_value1;
    ELSIF UPPER(v_search_type_in) = 'BILLINGPHONE'
    THEN
    v_sql_from := v_sql_from || ' ,order_payment op '
    || ' ,credit_card cc '
    v_sql_where := v_sql_where || ' ' || v_group_where
    || 'AND po.order_id = op.business_object_id '
    || 'AND op.business_object_type = ''ORDR'' '
    || 'AND op.payment_method = ''CRCD'' '
    || 'AND op.payment_method_id = cc.credit_card_id '
    || 'AND cc.home_phone = :v_search_value1_in '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_search_value1_in;
    ELSIF UPPER(v_search_type_in) = 'SHIPPINGPHONE'
    THEN
    v_sql_from := v_sql_from || ' ,shipping_info si '
    v_sql_where := v_sql_where || ' ' || v_group_where
    || 'AND po.order_id = si.order_id '
    || 'AND si.ship_phone = :v_search_value1_in '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_search_value1_in;
    ELSIF UPPER(v_search_type_in) = 'CREDITCARDNUMBER'
    THEN
    v_sql_from := v_sql_from || ' ,order_payment op '
    || ' ,credit_card cc '
    v_sql_where := v_sql_where || ' ' || v_group_where
    || 'AND po.order_id = op.business_object_id '
    || 'AND op.business_object_type = ''ORDR'' '
    || 'AND op.payment_method = ''CRCD'' '
    || 'AND op.payment_method_id = cc.credit_card_id '
    || 'AND cc.credit_card_number = :v_search_value1_in '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_search_value1_in;
    ELSIF UPPER(v_search_type_in) = 'PONUMBER'
    THEN
    v_sql_from := ' '
    || 'FROM ' || ' product_order_detail_actv_v pod ,' || SUBSTR(v_sql_from, 6);
    v_sql_where := v_sql_where || v_group_where
    || 'AND pod.po_no = :v_search_value1_in '
    || 'AND po.order_id = pod.order_id '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT /*+ ORDERED */ DISTINCT ' || v_sql_select || v_sql_from || v_sql_where
    USING v_search_value1_in;
    ELSIF UPPER(v_search_type_in) = 'USERASSIGNED'
    THEN
    IF v_search_value1_in = '0' -- 'Unassigned'
    THEN
    v_sql_where := v_sql_where || ' ' || v_group_where || ' ' || v_status_where
    || 'AND pog.unassigned_flag = ''Y'' '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_open_status, v_requested_status, v_cancelled_status, v_closed_status;
    ELSE
    v_sql_where := v_sql_where || ' ' || v_group_where || ' ' || v_status_where
    || 'AND pog.dn_employee_id = :v_search_value1_in '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_open_status, v_requested_status, v_cancelled_status, v_closed_status, v_search_value1_in;
    END IF;
    ELSIF UPPER(v_search_type_in) = 'ORDERDATE'
    THEN
    v_sql_where := v_sql_where || ' ' || v_group_where || ' ' || v_status_where
    || 'AND po.order_date BETWEEN TO_DATE( :v_search_value1_in, ''MON DD YYYY HH24:MI:SS'') AND TO_DATE( :v_search_value2_in ,''MON DD YYYY HH24:MI:SS'') '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_open_status, v_requested_status, v_cancelled_status, v_closed_status, v_search_value1_in, v_search_value2_in;
    ELSIF UPPER(v_search_type_in) = 'PRINTJOB'
    THEN
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select
    || ' '
    || 'FROM product_order po '
    || ' ,bcf_print_jobs pj '
    || 'WHERE 1 = 1 '
    || 'AND pj.order_id = po.order_id '
    || 'AND pj.username = :v_search_value1_in '
    || 'AND pj.create_date = TO_DATE( :v_search_value2_in,''MON DD YYYY HH24:MI:SS'') '
    || v_sql_order_by
    USING v_search_value1_in, v_search_value2_in;
    ELSIF UPPER(v_search_type_in) = 'FULFILLMENTTYPE'
    THEN
    v_sql_from := v_sql_from || ' ,product_order_detail_actv_v pod ';
    v_sql_where := v_sql_where || ' ' || v_group_where || ' ' || v_status_where
    || 'AND pod.order_id = po.order_id '
    -- Because we have to drill down the the POD level
    -- we now need to ensure the pod records match on group
    || 'AND pod.group_id = ' || v_group_for_search
    -- We curr. have 3 fufillment types FC165, FC212, FCBABY
    -- so substr on 1st char works for Garry
    || 'AND UPPER(SUBSTR(pod.fulfillment_type,1,1)) = UPPER(:v_search_value1_in) '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT DISTINCT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_open_status, v_requested_status, v_cancelled_status, v_closed_status, v_search_value1_in;
    ELSIF UPPER(v_search_type_in) = 'INSUFFICIENTAUTHORIZATION'
    THEN
    v_sql_where := v_sql_where
    || 'AND bcf_get_authorization_amount(po.order_id) > 0'
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by;
    END IF;
    END order_search;
    Thanks
    V
    Edited by: vishal patel on Oct 23, 2008 3:59 PM

    PROCEDURE order_search
    v_search_type_in IN VARCHAR2
    ,v_search_value1_in IN VARCHAR2 DEFAULT 'NONE'
    ,v_search_value2_in IN VARCHAR2 DEFAULT 'NONE'
    ,v_group_id_in IN bcf_groups.group_id%TYPE DEFAULT 0
    ,v_open_in IN NUMBER DEFAULT 0
    ,v_requested_in IN NUMBER DEFAULT 0
    ,v_cancelled_in IN NUMBER DEFAULT 0
    ,v_closed_in IN NUMBER DEFAULT 0
    ,v_employee_id_in IN sxweb00.customer.customer_id%TYPE DEFAULT 0
    ,outcursor IN OUT FulfillmentCurType
    IS
    v_status_code NUMBER;
    v_upper_search_value1 VARCHAR2(500);
    v_lower_search_value1 VARCHAR2(500);
    v_open_status VARCHAR2(10);
    v_closed_status VARCHAR2(10);
    v_cancelled_status VARCHAR2(10);
    v_requested_status VARCHAR2(10);
    v_group_for_search bcf_groups.group_id%TYPE;
    v_sql_select VARCHAR2(4000);
    v_sql_from VARCHAR2(4000);
    v_sql_where VARCHAR2(4000);
    v_sql_order_by VARCHAR2(4000);
    v_group_where VARCHAR2(100);
    v_status_where VARCHAR2(500);
    BEGIN
    IF v_open_in = 1 THEN
    v_open_status := 'OPEN';
    END IF;
    IF v_closed_in = 1 THEN
    v_closed_status := 'CLOSED';
    END IF;
    IF v_cancelled_in = 1 THEN
    v_cancelled_status := 'CANCELLED';
    END IF;
    IF v_requested_in = 1 THEN
    v_requested_status := 'REQUESTED';
    END IF;
    IF UPPER(v_search_type_in) = 'GROUP'
    THEN
    v_group_for_search := v_search_value1_in;
    ELSE
    v_group_for_search := v_group_id_in;
    END IF;
    -- This is the select statement used for all search types
    v_sql_select := ' '
    || 'po.order_id order_id '
    || ',decode('||v_group_id_in||',4,substr(bcf_locator.get_first_location(po.order_id,'||v_group_id_in||'),3),null) first_location '
    || ',TO_CHAR(po.order_date, ''mm/dd/yyyy'') order_date '
    || ',' || v_group_for_search || ' group_id '
    || ',TRIM(TO_CHAR(bcf_fulfillment.get_shipping_total(po.order_id,' || v_group_for_search || ') + bcf_fulfillment.get_tax_total(po.order_id,' || v_group_for_search || ') + bcf_fulfillment.get_subtotal(po.order_id,' || v_group_for_search || ') ,''$999,999,999,999,999,990.99'')) total '
    || ',bcf_fulfillment.get_billing_name (po.customer_id) billing_name '
    || ',bcf_fulfillment.get_open_and_assigned_count(po.order_id,' || v_group_for_search || ') open_and_assigned_count '
    || ',bcf_fulfillment.get_divisions(po.order_id,' || v_group_for_search || ') divisions '
    || ',bcf_fulfillment.get_division_count (po.order_id,' || v_group_for_search || ' ) division_count '
    || ',bcf_fulfillment.get_picker_list (po.order_id,' || v_group_for_search || ') picker_name '
    || ',bcf_fulfillment.get_picker_count (po.order_id,' || v_group_for_search || ') picker_count '
    || ',bcf_fulfillment.get_order_status(po.order_id,' || v_group_for_search || ') order_status '
    || ',po.customer_id customer_id '
    -- IF there is only one unique picker then that means there are no unassigned or NULL pickers
    -- therefore by default the checkbox should not be selected else the count picker_count is
    -- 0 or > 1 meaning that at least one line item has an unassigned employee_id and by default
    -- the checkbox should be selected
    || ',DECODE(bcf_fulfillment.get_picker_count(po.order_id,' || v_group_for_search || '),1 ,0,1) print_cb '
    || ',bcf_fulfillment.get_fulfillment_codes(po.order_id,' || v_group_for_search || ') fulfillment_types '
    || ',bcf_fulfillment.has_group_been_reassigned(po.order_id,' || v_group_for_search || ') group_reassigned_flag '
    || ',bcf_fulfillment.get_chain_codes(po.order_id,' || v_group_for_search || ') chain_codes '
    || ',po.status_id order_status_id '
    || ',bcf_fulfillment.get_viewed_by_picker_flag(po.order_id,' || v_group_for_search || ') viewed_by_picker_flag '
    || ',bcf_fulfillment.get_picker_list (po.order_id,' || v_group_for_search || ', ''N'') pickers_without_unassigned '
    || ',bcf_fulfillment.get_group_list (po.order_id) group_list '
    || ',bcf_fulfillment.get_line_item_count(po.order_id,' || v_group_for_search || ') line_item_count '
    || ',bcf_fulfillment.get_shipping_priority(po.order_id,' || v_group_for_search || ') shipping_priority'
    -- Anna wants all users to know and always wants to know no matter what the status of the auth or order
    || ',(SELECT decode(count(*),0,''N'',''Y'') FROM bcf_payment WHERE ics_rflag = ''DAVSNO'' AND order_id = po.order_id AND status_code IN (''ATH2'',''FUL2'',''CPT0'',''CPT2'')) avs_failed'
    || ',trunc(po.order_date) date_for_sort'
    -- When we need to look at all orders then the v_group_for_search will be zero i.e. customer service rep
    IF v_group_for_search = 0 THEN
    -- This is the core tables used by most search types
    v_sql_from := ' '
    || 'FROM product_order po'
    -- || ',bcf_lookup lu'
    -- This is the core table join needed for most search types
    v_sql_where := ' '
    || 'WHERE 1 = 1 '
    -- No orders will be looked at for fulfillment purposes that occurred before the minimum
    -- shipping cost functionality was added
    -- || 'AND po.order_date >= lu.implement_date '
    || 'AND po.order_date >= (SELECT min(implement_date) FROM bcf_lookup) '
    || 'AND po.submitted_flag = 1 '
    || 'AND po.channel_code = ''BCF'' '
    -- When we are looking at all orders then we are not going to restrict it by group
    v_group_where := ' ';
    -- This is used where the search type requires searching by the Open, Closed, and Cancelled status.
    -- We are binding the three status variables so that they can be cached in Oracle and not need to be parsed after
    -- the first search of a search type is done.
    v_status_where := ' '
    || 'AND bcf_fulfillment.get_order_status(po.order_id,' || v_group_for_search|| ') '
    || 'IN (:v_open_status, :v_requested_status, :v_cancelled_status, :v_closed_status) '
    ELSE
    -- This is the core tables used by most search types
    v_sql_from := ' '
    || 'FROM product_order po'
    || ',bcf_product_order_groups pog '
    -- This is the core table join needed for most search types
    v_sql_where := ' '
    || 'WHERE 1 = 1 '
    || 'AND po.order_id = pog.order_id '
    || 'AND po.channel_code = ''BCF'' '
    -- This is used only where the search type requires searching by a group.
    v_group_where := ' '
    || 'AND pog.group_id = ' || v_group_for_search
    -- This is used where the search type requires searching by the Open, Closed, and Cancelled status.
    -- We are binding the three status variables so that they can be cached in Oracle and not need to be parsed after
    -- the first search of a search type is done.
    v_status_where := ' '
    || 'AND pog.dn_status IN (:v_open_status, :v_requested_status, :v_cancelled_status, :v_closed_status) '
    END IF;
    -- If an employee_id is provided then we need to add in a where clause so that only orders that belong to that
    -- employee are pulled
    IF v_employee_id_in > 0
    THEN
    v_sql_where := v_sql_where
    || 'AND pog.dn_employee_id = ' || TO_CHAR(v_employee_id_in) || ' '
    END IF;
    IF v_group_id_in = get_group_fulfillment_center1
    THEN
    v_sql_order_by := 'ORDER BY '
    || 'bcf_fulfillment.get_division_count (po.order_id,' || v_group_for_search || ') '
    || ',bcf_fulfillment.get_divisions(po.order_id,' || v_group_for_search || ') '
    || ',po.order_id '
    ELSIF v_group_id_in = c_GROUP_FULFILLMENT_CENTER_212
    THEN
    v_sql_order_by := 'ORDER BY '
    || 'bcf_fulfillment.get_shipping_priority(po.order_id,' || v_group_for_search || ') DESC'
    || ',TRUNC(po.order_date)'
    || ',bcf_fulfillment.get_line_item_count(po.order_id,' || v_group_for_search || ')'
    || ',decode('||v_group_id_in||',4,substr(bcf_locator.get_first_location(po.order_id,'||v_group_id_in||'),3),null)'
    || ',po.order_id'
    ELSE
    v_sql_order_by := 'ORDER BY '
    || ' bcf_fulfillment.get_shipping_priority(po.order_id,' || v_group_for_search || ') DESC'
    || ',chain_codes DESC'
    || ',po.order_id '
    END IF;
    IF UPPER(v_search_type_in) = 'ORDERNUMBER'
    THEN
    v_sql_where := v_sql_where || v_group_where
    || 'AND po.order_id = :v_search_value1_in '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where
    USING v_search_value1_in;
    ELSIF UPPER(v_search_type_in) = 'STATUSONLY'
    THEN
    v_sql_where := v_sql_where || v_group_where || v_status_where
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_open_status, v_requested_status, v_cancelled_status, v_closed_status;
    ELSIF UPPER(v_search_type_in) = 'BILLINGNAME'
    THEN
    v_upper_search_value1 := UPPER(v_search_value1_in);
    v_sql_where := v_sql_where || ' ' || v_group_where
    || 'AND po.upper_billing_name LIKE ''%'' || :v_upper_search_value1 || ''%'' '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_upper_search_value1;
    ELSIF UPPER(v_search_type_in) = 'GROUP'
    THEN
    IF v_search_value1_in = '0' -- Unassigned
    THEN
    v_sql_from := v_sql_from || ' ,product_order_detail_actv_v pod ';
    v_sql_where := v_sql_where || ' ' || v_status_where
    || 'AND po.order_id = pod.order_id '
    || 'AND pod.group_id IS NULL '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT DISTINCT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_open_status, v_requested_status, v_cancelled_status, v_closed_status;
    ELSE
    v_sql_where := v_sql_where || ' ' || v_status_where
    || 'AND pog.group_id = :v_group_for_search '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_open_status, v_requested_status, v_cancelled_status, v_closed_status, v_group_for_search;
    END IF;
    ELSIF UPPER(v_search_type_in) = 'SHIPPINGNAME'
    THEN
    v_upper_search_value1 := UPPER(v_search_value1_in);
    v_sql_where := v_sql_where || ' ' || v_group_where
    || 'AND po.upper_shipping_name LIKE ''%'' || :v_upper_search_value1 || ''%'' '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_upper_search_value1;
    ELSIF UPPER(v_search_type_in) = 'USERNAME'
    THEN
    v_lower_search_value1 := LOWER(v_search_value1_in);
    v_sql_from := v_sql_from || ' ,sxweb01.customer c ';
    v_sql_where := v_sql_where || ' ' || v_group_where
    || 'AND po.customer_id = c.customer_id '
    || 'AND c.username LIKE ''%'' || :v_lower_search_value1 || ''%'' '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_lower_search_value1;
    ELSIF UPPER(v_search_type_in) = 'BILLINGADDRESS1'
    THEN
    v_upper_search_value1 := UPPER(v_search_value1_in);
    v_sql_from := v_sql_from || ' ,order_payment op '
    || ' ,credit_card cc '
    || ' ,om_address oma '
    v_sql_where := v_sql_where || ' ' || v_group_where
    || 'AND po.order_id = op.business_object_id '
    || 'AND op.business_object_type = ''ORDR'' '
    || 'AND op.payment_method = ''CRCD'' '
    || 'AND op.payment_method_id = cc.credit_card_id '
    || 'AND cc.address_id = oma.address_id '
    || 'AND UPPER(oma.address1) LIKE ''%'' || :v_upper_search_value1 || ''%'' '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_upper_search_value1;
    ELSIF UPPER(v_search_type_in) = 'SHIPPINGADDRESS1'
    THEN
    v_upper_search_value1 := UPPER(v_search_value1_in);
    v_sql_from := v_sql_from || ' ,shipping_info si '
    || ' ,om_address oma '
    v_sql_where := v_sql_where || ' ' || v_group_where
    || 'AND po.order_id = si.order_id '
    || 'AND si.ship_to_address_id = oma.address_id '
    || 'AND UPPER(oma.address1) LIKE ''%'' || :v_upper_search_value1 || ''%'' '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_upper_search_value1;
    ELSIF UPPER(v_search_type_in) = 'BILLINGPHONE'
    THEN
    v_sql_from := v_sql_from || ' ,order_payment op '
    || ' ,credit_card cc '
    v_sql_where := v_sql_where || ' ' || v_group_where
    || 'AND po.order_id = op.business_object_id '
    || 'AND op.business_object_type = ''ORDR'' '
    || 'AND op.payment_method = ''CRCD'' '
    || 'AND op.payment_method_id = cc.credit_card_id '
    || 'AND cc.home_phone = :v_search_value1_in '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_search_value1_in;
    ELSIF UPPER(v_search_type_in) = 'SHIPPINGPHONE'
    THEN
    v_sql_from := v_sql_from || ' ,shipping_info si '
    v_sql_where := v_sql_where || ' ' || v_group_where
    || 'AND po.order_id = si.order_id '
    || 'AND si.ship_phone = :v_search_value1_in '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_search_value1_in;
    ELSIF UPPER(v_search_type_in) = 'CREDITCARDNUMBER'
    THEN
    v_sql_from := v_sql_from || ' ,order_payment op '
    || ' ,credit_card cc '
    v_sql_where := v_sql_where || ' ' || v_group_where
    || 'AND po.order_id = op.business_object_id '
    || 'AND op.business_object_type = ''ORDR'' '
    || 'AND op.payment_method = ''CRCD'' '
    || 'AND op.payment_method_id = cc.credit_card_id '
    || 'AND cc.credit_card_number = :v_search_value1_in '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_search_value1_in;
    ELSIF UPPER(v_search_type_in) = 'PONUMBER'
    THEN
    v_sql_from := ' '
    || 'FROM ' || ' product_order_detail_actv_v pod ,' || SUBSTR(v_sql_from, 6);
    v_sql_where := v_sql_where || v_group_where
    || 'AND pod.po_no = :v_search_value1_in '
    || 'AND po.order_id = pod.order_id '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT /*+ ORDERED */ DISTINCT ' || v_sql_select || v_sql_from || v_sql_where
    USING v_search_value1_in;
    ELSIF UPPER(v_search_type_in) = 'USERASSIGNED'
    THEN
    IF v_search_value1_in = '0' -- 'Unassigned'
    THEN
    v_sql_where := v_sql_where || ' ' || v_group_where || ' ' || v_status_where
    || 'AND pog.unassigned_flag = ''Y'' '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_open_status, v_requested_status, v_cancelled_status, v_closed_status;
    ELSE
    v_sql_where := v_sql_where || ' ' || v_group_where || ' ' || v_status_where
    || 'AND pog.dn_employee_id = :v_search_value1_in '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_open_status, v_requested_status, v_cancelled_status, v_closed_status, v_search_value1_in;
    END IF;
    ELSIF UPPER(v_search_type_in) = 'ORDERDATE'
    THEN
    v_sql_where := v_sql_where || ' ' || v_group_where || ' ' || v_status_where
    || 'AND po.order_date BETWEEN TO_DATE( :v_search_value1_in, ''MON DD YYYY HH24:MI:SS'') AND TO_DATE( :v_search_value2_in ,''MON DD YYYY HH24:MI:SS'') '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_open_status, v_requested_status, v_cancelled_status, v_closed_status, v_search_value1_in, v_search_value2_in;
    ELSIF UPPER(v_search_type_in) = 'PRINTJOB'
    THEN
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select
    || ' '
    || 'FROM product_order po '
    || ' ,bcf_print_jobs pj '
    || 'WHERE 1 = 1 '
    || 'AND pj.order_id = po.order_id '
    || 'AND pj.username = :v_search_value1_in '
    || 'AND pj.create_date = TO_DATE( :v_search_value2_in,''MON DD YYYY HH24:MI:SS'') '
    || v_sql_order_by
    USING v_search_value1_in, v_search_value2_in;
    ELSIF UPPER(v_search_type_in) = 'FULFILLMENTTYPE'
    THEN
    v_sql_from := v_sql_from || ' ,product_order_detail_actv_v pod ';
    v_sql_where := v_sql_where || ' ' || v_group_where || ' ' || v_status_where
    || 'AND pod.order_id = po.order_id '
    -- Because we have to drill down the the POD level
    -- we now need to ensure the pod records match on group
    || 'AND pod.group_id = ' || v_group_for_search
    -- We curr. have 3 fufillment types FC165, FC212, FCBABY
    -- so substr on 1st char works for Garry
    || 'AND UPPER(SUBSTR(pod.fulfillment_type,1,1)) = UPPER(:v_search_value1_in) '
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT DISTINCT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by
    USING v_open_status, v_requested_status, v_cancelled_status, v_closed_status, v_search_value1_in;
    ELSIF UPPER(v_search_type_in) = 'INSUFFICIENTAUTHORIZATION'
    THEN
    v_sql_where := v_sql_where
    || 'AND bcf_get_authorization_amount(po.order_id) > 0'
    IF (outcursor%ISOPEN) THEN
    CLOSE outcursor;
    END IF;
    OPEN outcursor FOR
    'SELECT ' || v_sql_select || v_sql_from || v_sql_where || v_sql_order_by;
    END IF;
    END order_search;
    --

  • Need tool/utility to get list of tables from sql query

    Hi,
    I often have to analyze huge queries without having access to database. Is there any tool where I can submit the a sql query and it gives me list of tables used in the query.  I also need similar thing for documentation.
    Let me know if anybody uses anything like this.
    Thanks.
    liquidloop[at]live[dot]co[dot]uk

    You can find the size of each table, and thus list the tables in the process.
    SET NOCOUNT ON
    DBCC UPDATEUSAGE(0)
    -- DB size.
    EXEC sp_spaceused
    -- Table row counts and sizes.
    CREATE TABLE #t
    [name] NVARCHAR(128),
    [rows] CHAR(11),
    reserved VARCHAR(18),
    data VARCHAR(18),
    index_size VARCHAR(18),
    unused VARCHAR(18)
    INSERT #t EXEC sp_msForEachTable 'EXEC sp_spaceused ''?'''
    SELECT *
    FROM #t
    -- # of rows.
    SELECT SUM(CAST([rows] AS int)) AS [rows]
    FROM #t
    SELECT
    t.NAME AS TableName,
    p.rows AS RowCounts,
    SUM(a.total_pages) * 8 AS TotalSpaceKB,
    SUM(a.used_pages) * 8 AS UsedSpaceKB,
    (SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB
    FROM
    sys.tables t
    INNER JOIN
    sys.indexes i ON t.OBJECT_ID = i.object_id
    INNER JOIN
    sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id
    INNER JOIN
    sys.allocation_units a ON p.partition_id = a.container_id
    WHERE
    t.NAME NOT LIKE 'dt%'
    AND t.is_ms_shipped = 0
    AND i.OBJECT_ID > 255
    GROUP BY
    t.Name, p.Rows
    ORDER BY
    t.Name
    --- SQL2005
    select o.name
    , reservedpages = sum(a.total_pages)
    , usedpages = sum(a.used_pages)
    , pages = sum(case when a.type <> 1 then a.used_pages
    when p.index_id < 2 then a.data_pages else 0 end)
    , SUM(a.used_pages)*8096 AS 'Size(B)'
    , rows = sum(case when (p.index_id < 2) and (a.type = 1) then p.rows else 0 end)
    from sys.objects o
    join sys.partitions p on p.object_id = o.object_id
    join sys.allocation_units a on p.partition_id = a.container_id
    where o.type = 'U'
    group by o.name
    order by 3 desc --biggest tables first
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

  • Speed up SQL Query performance

    Hi,
    I am having a SQL query which has got some inner joins between tables.
    In this query i will be selecting values from set of values obtained by going through all rows in a table.
    I am using a inner join between two tables to achive this purpose.
    But, as the table which i go through all rows is extremely big it takes lot of time to go through all rows and the query slows down.
    Is there any other way by which i can speed up query.

    This is the out put of my test plan.
    Please suggest which one needs to be improved.
    PLAN_TABLE_OUTPUT
    Plan hash value: 3453987661
    | Id  | Operation                               | Name                           | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                        |                                |     3 |  1002 |  3920   (1)| 00:00:48 |
    |   1 |  SORT ORDER BY                          |                                |     3 |  1002 |  3920   (1)| 00:00:48 |
    |*  2 |   TABLE ACCESS BY INDEX ROWID           | AS_EVENT_CHR_DATA              |     1 |    17 |     4   (0)| 00:00:01 |
    |   3 |    NESTED LOOPS                         |                                |     3 |  1002 |  3919   (1)| 00:00:48 |
    |*  4 |     HASH JOIN                           |                                |     3 |   951 |  3907   (1)| 00:00:47 |
    |*  5 |      TABLE ACCESS FULL                  | EV_CHR_DATA_TYPE               |     1 |    46 |     2   (0)| 00:00:01 |
    |   6 |      TABLE ACCESS BY INDEX ROWID        | AS_EVENT_CHR_DATA              |   702 | 50544 |  3883   (1)| 00:00:47 |
    |   7 |       NESTED LOOPS                      |                                |   348 | 94308 |  3904   (1)| 00:00:47 |
    |   8 |        NESTED LOOPS                     |                                |     1 |   199 |    21   (5)| 00:00:01 |
    |   9 |         NESTED LOOPS                    |                                |     1 |   174 |    20   (5)| 00:00:01 |
    |* 10 |          HASH JOIN                      |                                |     1 |   127 |    18   (6)| 00:00:01 |
    |  11 |           NESTED LOOPS                  |                                |     1 |    95 |    13   (0)| 00:00:01 |
    |  12 |            NESTED LOOPS                 |                                |     1 |    60 |    12   (0)| 00:00:01 |
    |  13 |             NESTED LOOPS                |                                |     1 |    33 |    10   (0)| 00:00:01 |
    |  14 |              TABLE ACCESS BY INDEX ROWID| ASSET                          |     1 |    21 |     2   (0)| 00:00:01 |
    |* 15 |               INDEX UNIQUE SCAN         | SERIAL_NUMBER_K3               |     1 |       |     1   (0)| 00:00:01 |
    |* 16 |              INDEX FAST FULL SCAN       | SYS_C0053318                   |     1 |    12 |     8   (0)| 00:00:01 |
    |  17 |             TABLE ACCESS BY INDEX ROWID | SEGMENT_CHILD                  |     1 |    27 |     2   (0)| 00:00:01 |
    |* 18 |              INDEX RANGE SCAN           | SYS_C0053319                   |    12 |       |     1   (0)| 00:00:01 |
    |  19 |            TABLE ACCESS BY INDEX ROWID  | SEGMENT                        |     1 |    35 |     1   (0)| 00:00:01 |
    |* 20 |             INDEX UNIQUE SCAN           | SYS_C0053318                   |     1 |       |     0   (0)| 00:00:01 |
    |* 21 |           TABLE ACCESS FULL             | SEGMENT_TYPE                   |     1 |    32 |     4   (0)| 00:00:01 |
    |  22 |          TABLE ACCESS BY INDEX ROWID    | ASSET_ON_SEGMENT               |     1 |    47 |     2   (0)| 00:00:01 |
    |* 23 |           INDEX RANGE SCAN              | ASSET_ON_SEGME_UK8115533871153 |     1 |       |     1   (0)| 00:00:01 |
    |  24 |         TABLE ACCESS BY INDEX ROWID     | ASSET                          |     1 |    25 |     1   (0)| 00:00:01 |
    |* 25 |          INDEX UNIQUE SCAN              | SYS_C0053240                   |     1 |       |     0   (0)| 00:00:01 |
    |* 26 |        INDEX RANGE SCAN                 | AS_EV_CHR_DATA_ASSETPK         |  4673 |       |    28   (4)| 00:00:01 |
    |* 27 |     INDEX RANGE SCAN                    | SYS_C0053249                   |     5 |       |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - filter("PARAMETRIC_TAG_NAME"."DATA_VALUE"='EngineOilConsumption')
       4 - access("AS_EVENT_CHR_DATA"."EC_DB_SITE"="EV_CHR_DATA_TYPE"."EC_DB_SITE" AND
                  "AS_EVENT_CHR_DATA"."EC_DB_ID"="EV_CHR_DATA_TYPE"."EC_DB_ID" AND
                  "AS_EVENT_CHR_DATA"."EC_TYPE_CODE"="EV_CHR_DATA_TYPE"."EC_TYPE_CODE")
       5 - filter("EV_CHR_DATA_TYPE"."NAME"='servicing ptric time unit')
      10 - access("OILSEG"."SG_TYPE_CODE"="SEGMENT_TYPE"."SG_TYPE_CODE")
      15 - access("ASSET"."SERIAL_NUMBER"='30870')
      16 - filter("ASSET"."ASSET_ID"="SEGMENT"."SEGMENT_ID")
      18 - access("SEGMENT"."SEGMENT_SITE"="SEGMENT_CHILD"."SEGMENT_SITE" AND
                  "SEGMENT"."SEGMENT_ID"="SEGMENT_CHILD"."SEGMENT_ID")
      20 - access("SEGMENT_CHILD"."CHILD_SG_SITE"="OILSEG"."SEGMENT_SITE" AND
                  "SEGMENT_CHILD"."CHILD_SG_ID"="OILSEG"."SEGMENT_ID")
      21 - filter("SEGMENT_TYPE"."NAME"='Aircraft Equipment Engine Holder')
      23 - access("OILSEG"."SEGMENT_ID"="ASSET_ON_SEGMENT"."SEGMENT_ID")
      25 - access("ASSET_ON_SEGMENT"."ASSET_ORG_SITE"="OILASSET"."ASSET_ORG_SITE" AND
                  "ASSET_ON_SEGMENT"."ASSET_ID"="OILASSET"."ASSET_ID")
      26 - access("ASSET_ON_SEGMENT"."ASSET_ORG_SITE"="AS_EVENT_CHR_DATA"."ASSET_ORG_SITE" AND
                  "ASSET_ON_SEGMENT"."ASSET_ID"="AS_EVENT_CHR_DATA"."ASSET_ID")
      27 - access("AS_EVENT_CHR_DATA"."AS_EV_ID"="PARAMETRIC_TAG_NAME"."AS_EV_ID")

  • CrystalRpts - Excel Data source, SQLServer2005 table. SQL Query behavior?

    Greetings - What should be a simple report (with Excel 2007 spreadsheet as primary data source linking to a SQLServer 2005 table ) returns incorrect results.  Query designed to select data from SQL Table with  'DATES >=' certain date, but data returned ignores the DATE qualifier.
    Running DATE query manually against the SQL Table proves the data is correct. 
    Anyone notice problems with SQL Query behavior when mixing data sources?  Thanks.

    Hello,
    Take the SQL that works outside of CR and then create a new report and add all data sources. Now use a Command Object and paste in your SQL. YOu may have to play with adding each data source in a different order. If that works great if not you'll have to figure out a way to get all the data into one source.
    I believe MS SQL Server can link multiple data sources and types. Check SQL Help file for more info it it is possible.
    Thank you
    Don

  • Retreving Hexadecimal Values from a table using SQL query.

    Hi,
    I'm looking for a query to retreive Hexadecimal values contained in a column using SQL query.
    The column contains the values of all types, alphanumeric, numeric and hexadecimal.
    I need to retreive only hexadecimal values.
    any help to me in this regard will be appreciated.
    Thanks

    Presumably, you can be sure that any valid hex value is indeed MEANT to BE a hex value. For example the value 'ACE' is meant to be a hexadecimal value and not the word.

  • How to compare same SQL query performance in different DB servers.

    We have Production and Validation Environment of Oracle11g DB on two Solaris OSs.
    H/W and DB,etc configurations of two Oracle DBs are almost same in PROD and VAL.
    But we detected large SQL query performace difference in PROD DB and VAL DB in same SQL query.
    I would like to find and solve the cause of this situation.
    How could I do that ?
    I plan to compare SQL execution plan in PROD and VAL DB and index fragmentations.
    Before that I thought I need to keep same condition of DB statistics information in PROD and VAL DB.
    So, I plan to execute alter system FLUSH BUFFER_CACHE;
    But I am worring about bad effects of alter system FLUSH BUFFER_CACHE; to end users
    If we did alter system FLUSH BUFFER_CACHE; and got execution plan of that SQL query in the time end users do not use that system ,
    there is not large bad effect to end users after those operations?
    Could you please let me know the recomendation to compare SQL query performace ?

    Thank you.
    I got AWR report for only VAL DB server but it looks strange.
    Is there any thing wrong in DB or how to get AWR report ?
    Host Name
    Platform
    CPUs
    Cores
    Sockets
    Memory (GB)
    xxxx
    Solaris[tm] OE (64-bit)
    .00
    Snap Id
    Snap Time
    Sessions
    Cursors/Session
    Begin Snap:
    xxxx
    13-Apr-15 04:00:04
    End Snap:
    xxxx
    14-Apr-15 04:00:22
    Elapsed:
    1,440.30 (mins)
    DB Time:
    0.00 (mins)
    Report Summary
    Cache Sizes
    Begin
    End
    Buffer Cache:
    M
    M
    Std Block Size:
    K
    Shared Pool Size:
    0M
    0M
    Log Buffer:
    K
    Load Profile
    Per Second
    Per Transaction
    Per Exec
    Per Call
    DB Time(s):
    0.0
    0.0
    0.00
    0.00
    DB CPU(s):
    0.0
    0.0
    0.00
    0.00
    Redo size:
    Logical reads:
    0.0
    1.0
    Block changes:
    0.0
    1.0
    Physical reads:
    0.0
    1.0
    Physical writes:
    0.0
    1.0
    User calls:
    0.0
    1.0
    Parses:
    0.0
    1.0
    Hard parses:
    W/A MB processed:
    16.7
    1,442,472.0
    Logons:
    Executes:
    0.0
    1.0
    Rollbacks:
    Transactions:
    0.0
    Instance Efficiency Percentages (Target 100%)
    Buffer Nowait %:
    Redo NoWait %:
    Buffer Hit %:
    In-memory Sort %:
    Library Hit %:
    96.69
    Soft Parse %:
    Execute to Parse %:
    0.00
    Latch Hit %:
    Parse CPU to Parse Elapsd %:
    % Non-Parse CPU:
    Shared Pool Statistics
    Begin
    End
    Memory Usage %:
    % SQL with executions>1:
    34.82
    48.31
    % Memory for SQL w/exec>1:
    63.66
    73.05
    Top 5 Timed Foreground Events
    Event
    Waits
    Time(s)
    Avg wait (ms)
    % DB time
    Wait Class
    DB CPU
    0
    100.00
    Host CPU (CPUs: Cores: Sockets: )
    Load Average Begin
    Load Average End
    %User
    %System
    %WIO
    %Idle
    Instance CPU
    %Total CPU
    %Busy CPU
    %DB time waiting for CPU (Resource Manager)
    Memory Statistics
    Begin
    End
    Host Mem (MB):
    SGA use (MB):
    46,336.0
    46,336.0
    PGA use (MB):
    713.6
    662.6
    % Host Mem used for SGA+PGA:
    Time Model Statistics
    No data exists for this section of the report.
    Back to Wait Events Statistics
    Back to Top
    Operating System Statistics
    No data exists for this section of the report.
    Back to Wait Events Statistics
    Back to Top
    Operating System Statistics - Detail
    No data exists for this section of the report.
    Back to Wait Events Statistics
    Back to Top
    Foreground Wait Class
    s - second, ms - millisecond - 1000th of a second
    ordered by wait time desc, waits desc
    %Timeouts: value of 0 indicates value was < .5%. Value of null is truly 0
    Captured Time accounts for % of Total DB time .00 (s)
    Total FG Wait Time: (s) DB CPU time: .00 (s)
    Wait Class
    Waits
    %Time -outs
    Total Wait Time (s)
    Avg wait (ms)
    %DB time
    DB CPU
    0
    100.00
    Back to Wait Events Statistics
    Back to Top
    Foreground Wait Events
    No data exists for this section of the report.
    Back to Wait Events Statistics
    Back to Top
    Background Wait Events
    ordered by wait time desc, waits desc (idle events last)
    Only events with Total Wait Time (s) >= .001 are shown
    %Timeouts: value of 0 indicates value was < .5%. Value of null is truly 0
    Event
    Waits
    %Time -outs
    Total Wait Time (s)
    Avg wait (ms)
    Waits /txn
    % bg time
    log file parallel write
    527,034
    0
    2,209
    4
    527,034.00
    db file parallel write
    381,966
    0
    249
    1
    381,966.00
    os thread startup
    2,650
    0
    151
    57
    2,650.00
    latch: messages
    125,526
    0
    89
    1
    125,526.00
    control file sequential read
    148,662
    0
    54
    0
    148,662.00
    control file parallel write
    41,935
    0
    28
    1
    41,935.00
    Log archive I/O
    5,070
    0
    14
    3
    5,070.00
    Disk file operations I/O
    8,091
    0
    10
    1
    8,091.00
    log file sequential read
    3,024
    0
    6
    2
    3,024.00
    db file sequential read
    1,299
    0
    2
    2
    1,299.00
    latch: shared pool
    722
    0
    1
    1
    722.00
    enq: CF - contention
    4
    0
    1
    208
    4.00
    reliable message
    1,316
    0
    1
    1
    1,316.00
    log file sync
    71
    0
    1
    9
    71.00
    enq: CR - block range reuse ckpt
    36
    0
    0
    13
    36.00
    enq: JS - queue lock
    459
    0
    0
    1
    459.00
    log file single write
    414
    0
    0
    1
    414.00
    enq: PR - contention
    5
    0
    0
    57
    5.00
    asynch descriptor resize
    67,076
    100
    0
    0
    67,076.00
    LGWR wait for redo copy
    5,184
    0
    0
    0
    5,184.00
    rdbms ipc reply
    1,234
    0
    0
    0
    1,234.00
    ADR block file read
    384
    0
    0
    0
    384.00
    SQL*Net message to client
    189,490
    0
    0
    0
    189,490.00
    latch free
    559
    0
    0
    0
    559.00
    db file scattered read
    17
    0
    0
    6
    17.00
    resmgr:internal state change
    1
    100
    0
    100
    1.00
    direct path read
    301
    0
    0
    0
    301.00
    enq: RO - fast object reuse
    35
    0
    0
    2
    35.00
    direct path write
    122
    0
    0
    1
    122.00
    latch: cache buffers chains
    260
    0
    0
    0
    260.00
    db file parallel read
    1
    0
    0
    41
    1.00
    ADR file lock
    144
    0
    0
    0
    144.00
    latch: redo writing
    55
    0
    0
    1
    55.00
    ADR block file write
    120
    0
    0
    0
    120.00
    wait list latch free
    2
    0
    0
    10
    2.00
    latch: cache buffers lru chain
    44
    0
    0
    0
    44.00
    buffer busy waits
    3
    0
    0
    2
    3.00
    latch: call allocation
    57
    0
    0
    0
    57.00
    SQL*Net more data to client
    55
    0
    0
    0
    55.00
    ARCH wait for archivelog lock
    78
    0
    0
    0
    78.00
    rdbms ipc message
    3,157,653
    40
    4,058,370
    1285
    3,157,653.00
    Streams AQ: qmn slave idle wait
    11,826
    0
    172,828
    14614
    11,826.00
    DIAG idle wait
    170,978
    100
    172,681
    1010
    170,978.00
    dispatcher timer
    1,440
    100
    86,417
    60012
    1,440.00
    Streams AQ: qmn coordinator idle wait
    6,479
    48
    86,413
    13337
    6,479.00
    shared server idle wait
    2,879
    100
    86,401
    30011
    2,879.00
    Space Manager: slave idle wait
    17,258
    100
    86,324
    5002
    17,258.00
    pmon timer
    46,489
    62
    86,252
    1855
    46,489.00
    smon timer
    361
    66
    86,145
    238628
    361.00
    VKRM Idle
    1
    0
    14,401
    14400820
    1.00
    SQL*Net message from client
    253,909
    0
    419
    2
    253,909.00
    class slave wait
    379
    0
    0
    0
    379.00
    Back to Wait Events Statistics
    Back to Top
    Wait Event Histogram
    No data exists for this section of the report.
    Back to Wait Events Statistics
    Back to Top
    Wait Event Histogram Detail (64 msec to 2 sec)
    No data exists for this section of the report.
    Back to Wait Events Statistics
    Back to Top
    Wait Event Histogram Detail (4 sec to 2 min)
    No data exists for this section of the report.
    Back to Wait Events Statistics
    Back to Top
    Wait Event Histogram Detail (4 min to 1 hr)
    No data exists for this section of the report.
    Back to Wait Events Statistics
    Back to Top
    Service Statistics
    No data exists for this section of the report.
    Back to Wait Events Statistics
    Back to Top
    Service Wait Class Stats
    No data exists for this section of the report.
    Back to Wait Events Statistics
    Back to Top
    SQL Statistics
    SQL ordered by Elapsed Time
    SQL ordered by CPU Time
    SQL ordered by User I/O Wait Time
    SQL ordered by Gets
    SQL ordered by Reads
    SQL ordered by Physical Reads (UnOptimized)
    SQL ordered by Executions
    SQL ordered by Parse Calls
    SQL ordered by Sharable Memory
    SQL ordered by Version Count
    Complete List of SQL Text
    Back to Top
    SQL ordered by Elapsed Time
    No data exists for this section of the report.
    Back to SQL Statistics
    Back to Top
    SQL ordered by CPU Time
    No data exists for this section of the report.
    Back to SQL Statistics
    Back to Top
    SQL ordered by User I/O Wait Time
    No data exists for this section of the report.
    Back to SQL Statistics
    Back to Top
    SQL ordered by Gets
    No data exists for this section of the report.
    Back to SQL Statistics
    Back to Top
    SQL ordered by Reads
    No data exists for this section of the report.
    Back to SQL Statistics
    Back to Top
    SQL ordered by Physical Reads (UnOptimized)
    No data exists for this section of the report.
    Back to SQL Statistics
    Back to Top
    SQL ordered by Executions
    No data exists for this section of the report.
    Back to SQL Statistics
    Back to Top
    SQL ordered by Parse Calls
    No data exists for this section of the report.
    Back to SQL Statistics
    Back to Top
    SQL ordered by Sharable Memory
    No data exists for this section of the report.
    Back to SQL Statistics
    Back to Top
    SQL ordered by Version Count
    No data exists for this section of the report.
    Back to SQL Statistics
    Back to Top
    Complete List of SQL Text
    No data exists for this section of the report.
    Back to SQL Statistics
    Back to Top
    Instance Activity Statistics
    Instance Activity Stats
    Instance Activity Stats - Absolute Values
    Instance Activity Stats - Thread Activity
    Back to Top
    Instance Activity Stats
    No data exists for this section of the report.
    Back to Instance Activity Statistics
    Back to Top
    Instance Activity Stats - Absolute Values
    No data exists for this section of the report.
    Back to Instance Activity Statistics
    Back to Top
    Instance Activity Stats - Thread Activity
    Statistics identified by '(derived)' come from sources other than SYSSTAT
    Statistic
    Total
    per Hour
    log switches (derived)
    69
    2.87
    Back to Instance Activity Statistics
    Back to Top
    IO Stats
    IOStat by Function summary
    IOStat by Filetype summary
    IOStat by Function/Filetype summary
    Tablespace IO Stats
    File IO Stats
    Back to Top
    IOStat by Function summary
    'Data' columns suffixed with M,G,T,P are in multiples of 1024 other columns suffixed with K,M,G,T,P are in multiples of 1000
    ordered by (Data Read + Write) desc
    Function Name
    Reads: Data
    Reqs per sec
    Data per sec
    Writes: Data
    Reqs per sec
    Data per sec
    Waits: Count
    Avg Tm(ms)
    Others
    28.8G
    20.55
    .340727
    16.7G
    2.65
    .198442
    1803K
    0.01
    Direct Reads
    43.6G
    57.09
    .517021
    411M
    0.59
    .004755
    0
    LGWR
    19M
    0.02
    .000219
    41.9G
    21.87
    .496493
    2760
    0.08
    Direct Writes
    16M
    0.00
    .000185
    8.9G
    1.77
    .105927
    0
    DBWR
    0M
    0.00
    0M
    6.7G
    4.42
    .079670
    0
    Buffer Cache Reads
    3.1G
    3.67
    .037318
    0M
    0.00
    0M
    260.1K
    3.96
    TOTAL:
    75.6G
    81.33
    .895473
    74.7G
    31.31
    .885290
    2065.8K
    0.51
    Back to IO Stats
    Back to Top
    IOStat by Filetype summary
    'Data' columns suffixed with M,G,T,P are in multiples of 1024 other columns suffixed with K,M,G,T,P are in multiples of 1000
    Small Read and Large Read are average service times, in milliseconds
    Ordered by (Data Read + Write) desc
    Filetype Name
    Reads: Data
    Reqs per sec
    Data per sec
    Writes: Data
    Reqs per sec
    Data per sec
    Small Read
    Large Read
    Data File
    53.2G
    78.33
    .630701
    8.9G
    7.04
    .105197
    0.37
    21.51
    Log File
    13.9G
    0.18
    .164213
    41.9G
    21.85
    .496123
    0.02
    2.93
    Archive Log
    0M
    0.00
    0M
    13.9G
    0.16
    .164213
    Temp File
    5.6G
    0.67
    .066213
    8.1G
    0.80
    .096496
    5.33
    3713.27
    Control File
    2.9G
    2.16
    .034333
    2G
    1.46
    .023247
    0.05
    19.98

Maybe you are looking for

  • Magic Mouse will not scroll

    Lion 10.7.5 on MacBook 13 inch. The mouse has started doing weird things. The cursor moves around the screen fine but I can not scroll. I think this happened with the last Lion upgrade. Strangely after sleeping all night, it started scrolling for a f

  • Still no address bar. There is just a speed dial box where the address bar should. Navagation has a check in it

    There is a check in the navigation box but there is still no address bar. The only thing that is where the address bar should be is speed dial icon. Above that is file, edit, history, etc, Below the speed dial icon there is most visited, getting star

  • Background audio ads even with no tabs open

    This is driving me nuts. I have searched for answers, but none help. I get random audio ads even when there is only a new tab open in Firefox 15. Started with "Congratulations, you won", but today for example, I get an ad for Disney World. Its incred

  • How to install Live cache in SCM 5 for APO

    Hi gurus... i have recently installed scm 5 on windows 2003 server with sp1 ,oracle 10g as database.. i have entered trans lc10 and saved it. now when i click on livecache monitoring  it's showing errors like this LiveCache :display error log Name an

  • Crystal Reports XI installation error with boagent.exe

    When installing the trial Crystal Reports XI R2 SP2 on Vista Home Premium SP2, I am getting a popup with an error: abnormal program termination with C:\Program Files\Common Files\InstallShield\UpdateService\boagent.exe. And then the installer shows E