Update query which taking more time

Hi
I am running an update query which takeing more time any help to run this fast.
update arm538e_tmp t
set t.qtr5 =(select (sum(nvl(m.net_sales_value,0))/1000) from mnthly_sales_actvty m
where m.vndr#=t.vndr#
and m.cust_type_cd=t.cust_type
and m.cust_type_cd<>13
and m.yymm between 201301 and 201303
group by m.vndr#,m.cust_type_cd;
help will be appreciable
thank you
Edited by: 960991 on Apr 16, 2013 7:11 AM

960991 wrote:
Hi
I am running an update query which takeing more time any help to run this fast.
update arm538e_tmp t
set t.qtr5 =(select (sum(nvl(m.net_sales_value,0))/1000) from mnthly_sales_actvty m
where m.vndr#=t.vndr#
and m.cust_type_cd=t.cust_type
and m.cust_type_cd13
and m.yymm between 201301 and 201303
group by m.vndr#,m.cust_type_cd;
help will be appreciable
thank youUpdates with subqueries can be slow. Get an execution plan for the update to see what SQL is doing.
Some things to look at ...
1. Are you sure you posted the right SQL? I could not "balance" the parenthesis - 4 "(" and 3 ")"
2. Unnecessary "(" ")" in the subquery "(sum" are confusing
3. Updates with subqueries can be slow. The tqtr5 value seems to evaluate to a constant. You might improve performance by computing the value beforehand and using a variable instead of the subquery
4. Subquery appears to be correlated - good! Make sure the subquery is properly indexed if it reads < 20% of the rows in the table (this figure depends on the version of Oracle)
5. Is tqtr5 part of an index? It is a bad idea to update indexed columns

Similar Messages

  • Query is taking more time to execute in PROD

    Hi All,
    Can anyone tell me why this query is taking more time when I am using for single trx_number record it is working fine but when I am trying to use all the records it is not fatching any records and it is keep on running.
    SELECT DISTINCT OOH.HEADER_ID
    ,OOH.ORG_ID
    ,ct.CUSTOMER_TRX_ID
    ,ool.ship_from_org_id
    ,ct.trx_number IDP_SHIPMENT_ID
    ,ctt.type STATUS_CODE
    ,SYSDATE STATUS_DATE
    ,ooh.attribute16 IDP_ORDER_NBR --Change based on testing on 21-JUL-2010 in UAT
    ,lpad(rac_bill.account_number,6,0) IDP_BILL_TO_CUSTOMER_NBR
    ,rac_bill.orig_system_reference
    ,rac_ship_party.party_name SHIP_TO_NAME
    ,raa_ship_loc.address1 SHIP_TO_ADDR1
    ,raa_ship_loc.address2 SHIP_TO_ADDR2
    ,raa_ship_loc.address3 SHIP_TO_ADDR3
    ,raa_ship_loc.address4 SHIP_TO_ADDR4
    ,raa_ship_loc.city SHIP_TO_CITY
    ,NVL(raa_ship_loc.state,raa_ship_loc.province) SHIP_TO_STATE
    ,raa_ship_loc.country SHIP_TO_COUNTRY_NAME
    ,raa_ship_loc.postal_code SHIP_TO_ZIP
    ,ooh.CUST_PO_NUMBER CUSTOMER_ORDER_NBR
    ,ooh.creation_date CUSTOMER_ORDER_DATE
    ,ool.actual_shipment_date DATE_SHIPPED
    ,DECODE(mp.organization_code,'CHP', 'CHESAPEAKE'
    ,'CSB', 'CHESAPEAKE'
    ,'DEP', 'CHESAPEAKE'
    ,'CHESAPEAKE') SHIPPED_FROM_LOCATION --'MEMPHIS' --'HOUSTON'
    ,ooh.freight_carrier_code FREIGHT_CARRIER
    ,NVL(XX_FSG_NA_FASTRAQ_IFACE.get_invoice_amount ('FREIGHT',ct.customer_trx_id,ct.org_id),0)
    + NVL(XX_FSG_NA_FASTRAQ_IFACE.get_line_fr_amt ('FREIGHT',ct.customer_trx_id,ct.org_id),0)FREIGHT_CHARGE
    ,ooh.freight_terms_code FREIGHT_TERMS
    ,'' IDP_BILL_OF_LADING
    ,(SELECT WAYBILL
    FROM WSH_DELIVERY_DETAILS_OE_V
    WHERE -1=-1
    AND SOURCE_HEADER_ID = ooh.header_id
    AND SOURCE_LINE_ID = ool.line_id
    AND ROWNUM =1) WAYBILL_CARRIER
    ,'' CONTAINERS
    ,ct.trx_number INVOICE_NBR
    ,ct.trx_date INVOICE_DATE
    ,NVL(XX_FSG_NA_FASTRAQ_IFACE.get_invoice_amount ('LINE',ct.customer_trx_id,ct.org_id),0) +
    NVL(XX_FSG_NA_FASTRAQ_IFACE.get_invoice_amount ('TAX',ct.customer_trx_id,ct.org_id),0) +
    NVL(XX_FSG_NA_FASTRAQ_IFACE.get_invoice_amount ('FREIGHT',ct.customer_trx_id,ct.org_id),0)INVOICE_AMOUNT
    ,NULL IDP_TAX_IDENTIFICATION_NBR
    ,NVL(XX_FSG_NA_FASTRAQ_IFACE.get_invoice_amount ('TAX',ct.customer_trx_id,ct.org_id),0) TAX_AMOUNT_1
    ,NULL TAX_DESC_1
    ,NULL TAX_AMOUNT_2
    ,NULL TAX_DESC_2
    ,rt.name PAYMENT_TERMS
    ,NULL RELATED_INVOICE_NBR
    ,'Y' INVOICE_PRINT_FLAG
    FROM ra_customer_trx_all ct
    ,ra_cust_trx_types_all ctt
    ,hz_cust_accounts rac_ship
    ,hz_cust_accounts rac_bill
    ,hz_parties rac_ship_party
    ,hz_locations raa_ship_loc
    ,hz_party_sites raa_ship_ps
    ,hz_cust_acct_sites_all raa_ship
    ,hz_cust_site_uses_all su_ship
    ,ra_customer_trx_lines_all rctl
    ,oe_order_lines_all ool
    ,oe_order_headers_all ooh
    ,mtl_parameters mp
    ,ra_terms rt
    ,OE_ORDER_SOURCES oos
    ,XLA_AR_INV_AEL_SL_V XLA_AEL_SL_V
    WHERE ct.cust_trx_type_id = ctt.cust_trx_type_id
    AND ctt.TYPE <> 'BR'
    AND ct.org_id = ctt.org_id
    AND ct.ship_to_customer_id = rac_ship.cust_account_id
    AND ct.bill_to_customer_id = rac_bill.cust_account_id
    AND rac_ship.party_id = rac_ship_party.party_id
    AND su_ship.cust_acct_site_id = raa_ship.cust_acct_site_id
    AND raa_ship.party_site_id = raa_ship_ps.party_site_id
    AND raa_ship_loc.location_id = raa_ship_ps.location_id
    AND ct.ship_to_site_use_id = su_ship.site_use_id
    AND su_ship.org_id = ct.org_id
    AND raa_ship.org_id = ct.org_id
    AND ct.customer_trx_id = rctl.customer_trx_id
    AND ct.org_id = rctl.org_id
    AND rctl.interface_line_attribute6 = to_char(ool.line_id)
    AND rctl.org_id = ool.org_id
    AND ool.header_id = ooh.header_id
    AND ool.org_id = ooh.org_id
    AND mp.organization_id = ool.ship_from_org_id
    AND ooh.payment_term_id = rt.term_id
    AND xla_ael_sl_v.last_update_date >= NVL(p_last_update_date,xla_ael_sl_v.last_update_date)
    AND ooh.order_source_id = oos.order_source_id --Change based on testing on 19-May-2010
    AND oos.name = 'FASTRAQ' --Change based on testing on 19-May-2010
    AND ooh.org_id = g_org_id --Change based on testing on 19-May-2010
    AND ool.flow_status_code = 'CLOSED'
    AND xla_ael_sl_v.trx_hdr_id = ct.customer_trx_id
    AND trx_hdr_table = 'CT'
    AND xla_ael_sl_v.gl_transfer_status = 'Y'
    AND xla_ael_sl_v.accounted_dr IS NOT NULL
    AND xla_ael_sl_v.org_id = ct.org_id;
    -- AND ct.trx_number = '2000080';
    }

    Hello Friend,
    You query will definitely take more time or even fail in PROD,becuase the way it is written. Here are my few observations, may be it can help :-
    1. XLA_AR_INV_AEL_SL_V XLA_AEL_SL_V : Never use a view inside such a long query , becuase View is just a window to the records.
    and when used to join other table records, then all those tables which are used to create a view also becomes part of joining conition.
    First of all please check if you really need this view. I guess you are using to check if the records have been created as Journal entries or not ?
    Please check the possbility of finding it through other AR tables.
    2. Remove _ALL tables instead use the corresponding org specific views (if you are in 11i ) or the sysnonymns ( in R12 )
    For example : For ra_cust_trx_types_all use ra_cust_trx_types.
    This will ensure that the query will execute only for those ORG_IDs which are assigned to that responsibility.
    3. Check with the DBA whether the GATHER SCHEMA STATS have been run atleast for ONT and RA tables.
    You can also check the same using
    SELECT LAST_ANALYZED FROM ALL_TABLES WHERE TABLE_NAME = 'ra_customer_trx_all'.
    If the tables are not analyzed , the CBO will not be able to tune your query.
    4. Try to remove the DISTINCT keyword. This is the MAJOR reason for this problem.
    5. If its a report , try to separate the logic in separate queries ( using a procedure ) and then populate the whole data in custom table, and use this custom table for generating the
    report.
    Thanks,
    Neeraj Shrivastava
    [email protected]
    Edited by: user9352949 on Oct 1, 2010 8:02 PM
    Edited by: user9352949 on Oct 1, 2010 8:03 PM

  • Sql query is taking more time

    Hi all,
    db:oracle 9i
    I am facing below query prob.
    prob is that query is taking more time 45 min than earliar (10 sec).
    please any one suggest me .....
    SQL> SELECT MAX (tdar1.ID) ID, tdar1.request_id, tdar1.lolm_transaction_id,
    2 tdar1.transaction_version
    3 FROM transaction_data_arc tdar1
    4 WHERE tdar1.transaction_name ='O96U '
    5 AND tdar1.transaction_type = 'REQUEST'
    6 AND tdar1.message_type_code ='PCN'
    7 AND NOT EXISTS (
    8 SELECT NULL
    9 FROM transaction_data_arc tdar2
    10 WHERE tdar2.request_id = tdar1.request_id
    11 AND tdar2.lolm_transaction_id != tdar1.lolm_transaction_id
    12 AND tdar2.ID > tdar1.ID)
    13 GROUP BY tdar1.request_id,
    14 tdar1.lolm_transaction_id,
    15 tdar1.transaction_version;
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=17 Card=1 Bytes=42)
    1 0 SORT (GROUP BY) (Cost=12 Card=1 Bytes=42)
    2 1 FILTER
    3 2 TABLE ACCESS (BY INDEX ROWID) OF 'TRANSACTION_DATA_ARC
    ' (Cost=1 Card=1 Bytes=42)
    4 3 INDEX (RANGE SCAN) OF 'NK_TDAR_2' (NON-UNIQUE) (Cost
    =3 Card=1)
    5 2 TABLE ACCESS (BY INDEX ROWID) OF 'TRANSACTION_DATA_ARC
    ' (Cost=5 Card=918 Bytes=20196)
    6 5 INDEX (RANGE SCAN) OF 'NK_TDAR_7' (NON-UNIQUE) (Cost
    =8 Card=4760)

    prob is that query is taking more time 45 min than earliar (10 sec).Then something must have changed (data growth/stale statistics/...?).
    You should post as much details as possible, how and what it is described in the FAQ, see:
    *3. How to improve the performance of my query? / My query is running slow*.
    When your query takes too long...
    How to post a SQL statement tuning request
    SQL and PL/SQL FAQ
    Also, given your database version, using NOT IN instead of NOT EXISTS might make a difference (but they're not the same).
    See: SQL and PL/SQL FAQ

  • Query is taking more time to execute

    Hi,
    Query is taking more time to execute.
    But when i execute same query in other server then it is giving immediate output.
    What is the reason of it.
    thanks in advance.

    'My car doesn't start, please help me to start my car'
    Do you think we are clairvoyant?
    Or is your salary subtracted for every letter you type here?
    Please be aware this is not a chatroom, and we can not see your webcam.
    Sybrand Bakker
    Senior Oracle DBA

  • Oracle 11g: Oracle insert/update operation is taking more time.

    Hello All,
    In Oracle 11g (Windows 2008 32 bit environment) we are facing following issue.
    1) We are inserting/updating data on some tables (4-5 tables and we are firing query with very high rate).
    2) After sometime (say 15 days with same load) we are feeling that the Oracle operation (insert/update) is taking more time.
    Query1: How to find actually oracle is taking more time in insert/updates operation.
    Query2: How to rectify the problem.
    We are having multithread environment.
    Thanks
    With Regards
    Hemant.

    Liron Amitzi wrote:
    Hi Nicolas,
    Just a short explanation:
    If you have a table with 1 column (let's say a number). The table is empty and you have an index on the column.
    When you insert a row, the value of the column will be inserted to the index. To insert 1 value to an index with 10 values in it will be fast. It will take longer to insert 1 value to an index with 1 million values in it.
    My second example was if I take the same table and let's say I insert 10 rows and delete the previous 10 from the table. I always have 10 rows in the table so the index should be small. But this is not correct. If I insert values 1-10 and then delete 1-10 and insert 11-20, then delete 11-20 and insert 21-30 and so on, because the index is sorted, where 1-10 were stored I'll now have empty spots. Oracle will not fill them up. So the index will become larger and larger as I insert more rows (even though I delete the old ones).
    The solution here is simply revuild the index once in a while.
    Hope it is clear.
    Liron Amitzi
    Senior DBA consultant
    [www.dbsnaps.com]
    [www.orbiumsoftware.com]Hmmm, index space not reused ? Index rebuild once a while ? That was what I understood from your previous post, but nothing is less sure.
    This is a misconception of how indexes are working.
    I would suggest the reading of the following interasting doc, they are a lot of nice examples (including index space reuse) to understand, and in conclusion :
    http://richardfoote.files.wordpress.com/2007/12/index-internals-rebuilding-the-truth.pdf
    "+Index Rebuild Summary+
    +•*The vast majority of indexes do not require rebuilding*+
    +•Oracle B-tree indexes can become “unbalanced” and need to be rebuilt is a myth+
    +•*Deleted space in an index is “deadwood” and over time requires the index to be rebuilt is a myth*+
    +•If an index reaches “x” number of levels, it becomes inefficient and requires the index to be rebuilt is a myth+
    +•If an index has a poor clustering factor, the index needs to be rebuilt is a myth+
    +•To improve performance, indexes need to be regularly rebuilt is a myth+"
    Good reading,
    Nicolas.

  • My update query is taking more tablespace.. so please advice

    Hi All,
    My update statement is taking more tablespace suddently. so I got error 'unable to extend the tablespace'. After extended the tablespace, I got completed..but those extended tablespace also got filled immetiately. Can you guys please suggest me for some solutions for this case.
    "-- Proc to update the lvl 2 dfus in the dfuprojdraftstatic table with cust orders
    procedure update_lvl2_dpds_custorders is
    cv cur_type;
    v_lvl1_dmdgroup varchar2(50) := null;
    v_lvl1_loc varchar2(50) := null;
    v_first_one number;
    a number;
    begin
    for x in (select distinct dmdgroup lvl2_dmdgroup, loc lvl2_loc
    from dfuprojdraftstatic s
    where (dmdunit,dmdgroup,loc) in (select dmdunit,dmdgroup,loc from dfuview v
    where u_dfu_lvl = 2)
    and dmdunit in (select dmdunit from dmdunit
    where u_moe = in_moe) ) loop
    v_first_one := 1;
    -- Using dynamic sql, loop through the lvl 1 dmdgroups and locs for this lvl 2 dmdgroup and loc
    --open cv for v_sql_stmt using v_cntry_cd, x.lvl2_dmdgroup, v_cntry_cd, x.lvl2_loc;
    open cv for v_sql_stmt using x.lvl2_dmdgroup,in_moe;
    loop
    fetch cv into v_lvl1_dmdgroup, v_lvl1_loc;
    exit when cv%notfound;
    UPDATE dfuprojdraftstatic s
    SET u_cust_ordr = (SELECT decode(v_first_one, 1, 0, u_cust_ordr) + nvl(sum(qty), 0)
    FROM cust_orders o, mars_week_cal c
    WHERE o.mrkt_moe = in_moe
    AND o.dmdunit = s.dmdunit
    AND o.dmdgroup = v_lvl1_dmdgroup
    AND o.loc = v_lvl1_loc
    AND o.start_date BETWEEN c.week_start_dat AND c.week_end_dat
    AND c.week_start_dat = s.startdate
    WHERE startdate >= v_max_dpd
    AND (dmdunit,dmdgroup,loc) in (select dmdunit,dmdgroup,loc from dfuview v
    where u_dfu_lvl = 2 )
    AND dmdunit in (select dmdunit from dmdunit
    where u_moe = in_moe )
    AND s.dmdgroup = x.lvl2_dmdgroup
    AND s.loc = x.lvl2_loc;
    dbms_output.put_line('A '||a+1);
    if v_first_one = 1 then
    v_first_one := 0;
    end if;
    end loop;
    close cv;
    end loop;
    commit;
    end; -- update_lvl2_dpds_custorders
    Thanks and Regards,
    Sudhakar.M

    Without seeing the full code like, for example, the definition of v_sql_stmt, and without knowing you tables and data, my guess would be that, based on the code provided, the update process is extremely inefficient and is likely updating the same row multiple times in this procedure, and even more likely in the entire set of provedures.
    Based on the erro message, it appears that you are running a package called batch_upd_dfuprojdraftstatic. Based on the name of the procedure you show, I also suspect that there are several other procedures that update single columns of dfuprojdraftstatic one after the other.
    I know that the table dfuprojdraftstatic is at least part of the base for a materialized view (mlog$_dfuprojdraftstatic is the materialized view log attached to the table to track changes for refreshing the materialized view). For each update you issue, Oracle creates a record in the materialized view log tracking what changed. If you do update col1, that creates a record in the log for each row , if you subsequently do update col2 that creates a second record for each row. However, if you do update col1, col2, that only creates a single record for each row. So, updating all of the columns requiring updates at the same time will reduce the number of the materialized view log entries, which should reduce the space required.
    You may alos want to loko at purging some of the data form the log using the dbms_mview package.
    John

  • Optimizing the query - which takes more time

    Hi,
    Am having a query which was returning the results pretty fast one week back but now the same query takes more time to respond, nothing much changed in the table data, what could be the problem. Am using IN in the where clause, whether that could be an issue? if so what is the best method of rewriting the query.
    SELECT  RI.RESOURCE_NAME,TR.MSISDN,MAX(TR.ADDRESS1_GOOGLE) KEEP(DENSE_RANK LAST ORDER BY TR.MSG_DATE_INFO) ADDRESS1_GOOGLE,
                    MAX(TR.TIME_STAMP) MSG_DATE_INFO FROM  TRACKING_REPORT TR, RESOURCE_INFO RI
                    WHERE TR.MSISDN IN ( SELECT  MSISDN FROM  RESOURCE_INFO WHERE GROUP_ID ='4'
                   AND COM_ID='12') AND RI.MSISDN = TR.MSISDN
                   GROUP BY  RI.RESOURCE_NAME,TR.MSISDN ORDER BY MSG_DATE_INFO DESC

    Hi
    i have followed this link http://www.lorentzcenter.nl/awcourse/oracle/server.920/a96533/sqltrace.htm in enabling the trace and found out the following trace output, can you explain the problem here and its remedial action pls.
    SELECT  RI.RESOURCE_NAME,TR.MSISDN,MAX(TR.ADDRESS1_GOOGLE) KEEP(DENSE_RANK
      LAST ORDER BY TR.MSG_DATE_INFO) ADDRESS1_GOOGLE,                      MAX(TR.TIME_STAMP)
      MSG_DATE_INFO
    FROM
      TRACKING_REPORT TR, RESOURCE_INFO RI                          WHERE RI.GROUP_ID ='426'                         AND
      RI.COM_ID='122' AND RI.MSISDN = TR.MSISDN                      GROUP BY  RI.RESOURCE_NAME,
      TR.MSISDN
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.01       0.02          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        6     13.69     389.03      81747     280722          0          72
    total        8     13.70     389.05      81747     280722          0          72
    Misses in library cache during parse: 1
    Optimizer goal: CHOOSE
    Parsing user id: 281 
    Rows     Row Source Operation
         72  SORT GROUP BY
    276558   NESTED LOOPS 
         79    TABLE ACCESS FULL RESOURCE_INFO
    276558    TABLE ACCESS BY INDEX ROWID TRACKING_REPORT
    276558     INDEX RANGE SCAN TR_INDX_ON_MSISDN_TIME (object id 60507)
    ********************************************************************************and the plan_table output is
    STATEMENT_ID     TIMESTAMP     REMARKS     OPERATION     OPTIONS     OBJECT_NODE     OBJECT_OWNER     OBJECT_NAME     OBJECT_INSTANCE     OBJECT_TYPE     OPTIMIZER     SEARCH_COLUMNS     ID     PARENT_ID     POSITION     COST     CARDINALITY     BYTES     OTHER_TAG     PARTITION_START     PARTITION_STOP     PARTITION_ID     OTHER     DISTRIBUTION     CPU_COST     IO_COST     TEMP_SPACE     ACCESS_PREDICATES     FILTER_PREDICATES
         23-Mar-11 23:36:45          SELECT STATEMENT                                   CHOOSE          0          115     115     1058     111090                                        115               
         23-Mar-11 23:36:45          SORT     GROUP BY                                        1     0     1     115     1058     111090                                        115               
         23-Mar-11 23:36:45          NESTED LOOPS                                             2     1     1     9     4603     483315                                        9               
         23-Mar-11 23:36:45          TABLE ACCESS     FULL          BSNL_RTMS     RESOURCE_INFO     2          ANALYZED          3     2     1     8     1     30                                        8               "RI"."GROUP_ID"=426 AND "RI"."COM_ID"='122'
         23-Mar-11 23:36:45          TABLE ACCESS     BY INDEX ROWID          BSNL_RTMS     TRACKING_REPORT     1          ANALYZED          4     2     2     1     3293     246975                                        1               
         23-Mar-11 23:36:45          INDEX     RANGE SCAN          BSNL_RTMS     TR_INDX_ON_MSISDN_TIME          NON-UNIQUE          1     5     4     1     1     3293                                             1          "RI"."MSISDN"="TR"."MSISDN"     

  • Query is taking more time

    Hi ,
    I am using oracle 10g .My query is as below
    SELECT /*+ PARALLEL(s ,4) */
    s.*
    FROM test_01_ext a,
    test_opn_acc_ext b
    WHERE a.site_no = b.site_no (+)
    AND a.cntry_cd = b.Loc_cntry_code (+)
    both the tables are external tables having millions of record taking more than 7 hrs for execution. Can anybody help in this regards

    Note the name of this forum is "SQL Developer *(Not for general SQL/PLSQL questions)*", so only for issues with the SQL Developer tool. Please post these questions under the dedicated [SQL And PL/SQL|https://forums.oracle.com/forums/forum.jspa?forumID=75] forum.
    Regards,
    K.

  • View query execution taking more time

    hi all,
    what would be the reason that my event view is still not getting executed for around 24 hours.
    actually i created 2 event views one is like ora1 and another is like ora1_1 both are having the same data.
    the first view ora1 executed by 14 hours.
    but my second view still not get executed it is still running for last 30 hours.
    very urgent.
    plz tell me the reason for the delay
    and if possible provide me a solution too
    thanks in advance
    suresh

    Dear sir,
    Please find the Scripts & Explain Plan for the Scripts in the attachment (ABC.zip)
    ABCReports51_new.sql - Fetching values from EVENT_T_VIEW
    ABCReports51_new_1.sql - Fetching values from EVENT_T
    create_event_view.sql - Command executed to create EVENT_T_VIEW
    ExplainPlan4event_t.txt - Explain Plan for the Query fetching values from event_t table
    ExplainPlan4event_t_view.txt - Explain Plan for the Query fetching values from event_t_view
    indexed_columns.txt - Indexed columns in event_t
    TableDesc.txt - Table description for event_t, event_bal_impacts_t, event_session_dialup_t
    SQL> desc event_bal_impacts_t;
    Name Null? Type
    OBJ_ID0 NUMBER(38)
    REC_ID NUMBER(38)
    ACCOUNT_OBJ_DB NUMBER(38)
    ACCOUNT_OBJ_ID0 NUMBER(38)
    ACCOUNT_OBJ_TYPE VARCHAR2(255)
    ACCOUNT_OBJ_REV NUMBER(38)
    AMOUNT NUMBER
    AMOUNT_DEFERRED NUMBER
    AMOUNT_ORIG NUMBER
    DISCOUNT NUMBER
    GL_ID NUMBER(38)
    IMPACT_CATEGORY VARCHAR2(255)
    IMPACT_TYPE NUMBER(38)
    ITEM_OBJ_DB NUMBER(38)
    ITEM_OBJ_ID0 NUMBER(38)
    ITEM_OBJ_TYPE VARCHAR2(255)
    ITEM_OBJ_REV NUMBER(38)
    PERCENT NUMBER
    PRODUCT_OBJ_DB NUMBER(38)
    PRODUCT_OBJ_ID0 NUMBER(38)
    PRODUCT_OBJ_TYPE VARCHAR2(255)
    PRODUCT_OBJ_REV NUMBER(38)
    QUANTITY NUMBER
    RATE_OBJ_DB NUMBER(38)
    RATE_OBJ_ID0 NUMBER(38)
    RATE_OBJ_TYPE VARCHAR2(255)
    RATE_OBJ_REV NUMBER(38)
    RATE_TAG VARCHAR2(255)
    RESOURCE_ID NUMBER(38)
    RESOURCE_ID_ORIG NUMBER(38)
    TAX_CODE VARCHAR2(255)
    NODE_LOCATION VARCHAR2(255)
    LINEAGE VARCHAR2(255)
    SQL> desc event_session_dialup_t;
    Name Null? Type
    OBJ_ID0 NUMBER(38)
    ANI VARCHAR2(120)
    BYTES_IN NUMBER(38)
    BYTES_OUT NUMBER(38)
    DESCR VARCHAR2(255)
    DNIS VARCHAR2(60)
    IPADDR RAW(30)
    LOGIN VARCHAR2(255)
    NETWORK VARCHAR2(30)
    PACKETS_IN NUMBER(38)
    PACKETS_OUT NUMBER(38)
    SPEED NUMBER(38)
    STATUS NUMBER(38)
    TERM_CAUSE NUMBER(38)
    TERMSERV_ID VARCHAR2(60)
    TERMSERV_PORT VARCHAR2(60)
    TIMEZONE NUMBER(38)
    TRANS_ID VARCHAR2(60)
    TYPE NUMBER(38)
    UNITS NUMBER(38)
    SQL> desc event_t;
    Name Null? Type
    POID_DB NUMBER(38)
    POID_ID0 NUMBER(38)
    POID_TYPE VARCHAR2(255)
    POID_REV NUMBER(38)
    CREATED_T NUMBER(38)
    MOD_T NUMBER(38)
    READ_ACCESS VARCHAR2(1)
    WRITE_ACCESS VARCHAR2(1)
    ACCOUNT_OBJ_DB NUMBER(38)
    ACCOUNT_OBJ_ID0 NUMBER(38)
    ACCOUNT_OBJ_TYPE VARCHAR2(255)
    ACCOUNT_OBJ_REV NUMBER(38)
    ARCHIVE_STATUS NUMBER(38)
    CURRENCY NUMBER(38)
    DESCR VARCHAR2(255)
    EFFECTIVE_T NUMBER(38)
    END_T NUMBER(38)
    EARNED_START_T NUMBER(38)
    EARNED_END_T NUMBER(38)
    EARNED_TYPE NUMBER(38)
    EVENT_NO VARCHAR2(60)
    FLAGS NUMBER(38)
    GROUP_OBJ_DB NUMBER(38)
    GROUP_OBJ_ID0 NUMBER(38)
    GROUP_OBJ_TYPE VARCHAR2(255)
    GROUP_OBJ_REV NUMBER(38)
    ITEM_OBJ_DB NUMBER(38)
    ITEM_OBJ_ID0 NUMBER(38)
    ITEM_OBJ_TYPE VARCHAR2(255)
    ITEM_OBJ_REV NUMBER(38)
    NAME VARCHAR2(255)
    PROGRAM_NAME VARCHAR2(60)
    PROVIDER_DESCR VARCHAR2(255)
    PROVIDER_ID_DB NUMBER(38)
    PROVIDER_ID_ID0 NUMBER(38)
    PROVIDER_ID_TYPE VARCHAR2(255)
    PROVIDER_ID_REV NUMBER(38)
    PROVIDER_IPADDR RAW(30)
    RUM_NAME VARCHAR2(255)
    TOD_MODE NUMBER(38)
    TIMEZONE_MODE NUMBER(38)
    MIN_QUANTITY NUMBER
    MIN_UNIT NUMBER(38)
    INCR_QUANTITY NUMBER
    INCR_UNIT NUMBER(38)
    ROUNDING_MODE NUMBER(38)
    NET_QUANTITY NUMBER
    UNRATED_QUANTITY NUMBER
    SERVICE_OBJ_DB NUMBER(38)
    SERVICE_OBJ_ID0 NUMBER(38)
    SERVICE_OBJ_TYPE VARCHAR2(255)
    SERVICE_OBJ_REV NUMBER(38)
    SESSION_OBJ_DB NUMBER(38)
    SESSION_OBJ_ID0 NUMBER(38)
    SESSION_OBJ_TYPE VARCHAR2(255)
    SESSION_OBJ_REV NUMBER(38)
    START_T NUMBER(38)
    SYS_DESCR VARCHAR2(255)
    TAX_LOCALES VARCHAR2(1024)
    TAX_SUPPLIER_ID_DB NUMBER(38)
    TAX_SUPPLIER_ID_ID0 NUMBER(38)
    TAX_SUPPLIER_ID_TYPE VARCHAR2(255)
    TAX_SUPPLIER_ID_REV NUMBER(38)
    USERID_DB NUMBER(38)
    USERID_ID0 NUMBER(38)
    USERID_TYPE VARCHAR2(255)
    USERID_REV NUMBER(38)
    INVOICE_DATA VARCHAR2(4000)
    RATED_TIMEZONE_ID VARCHAR2(64)
    TIMEZONE_ADJ_START_T NUMBER(38)
    TIMEZONE_ADJ_END_T NUMBER(38)
    TIMEZONE_ID VARCHAR2(64)
    UNIT NUMBER(38)
    RERATE_OBJ_DB NUMBER(38)
    RERATE_OBJ_ID0 NUMBER(38)
    RERATE_OBJ_TYPE VARCHAR2(255)
    RERATE_OBJ_REV NUMBER(38)
    select index_name, column_name, column_position from all_ind_columns where table_name like upper('event_t')
    INDEX_NAME COLUMN_NAME COLUMN_POSITION
    I_EVENT_CREATED_T CREATED_T 1
    I_EVENT_EVENT__NO EVENT_NO 1
    I_EVENT_ITEM_OBJ__ID ITEM_OBJ_ID0 1
    I_EVENT_NDX CREATED_T 1
    I_EVENT_NDX POID_ID0 2
    I_EVENT_PROVIDER__ID PROVIDER_ID_ID0 1
    I_EVENT__ACCTOBJ_END_T ACCOUNT_OBJ_ID0 1
    I_EVENT__ACCTOBJ_END_T END_T 2
    I_EVENT__END_T END_T 1
    I_EVENT__ID POID_ID0 1
    I_EVENT__SERVOBJ_END_T SERVICE_OBJ_ID0 1
    I_EVENT__SERVOBJ_END_T END_T 2
    explain plan for select 'Technical Building' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
    from event_bal_impacts_t c, event_session_dialup_t b, event_t_view a
    where
    end_t between date2unix(20060101000000) and date2unix(20060501000000) and
    b.obj_id0 = a.poid_id0 and
    c.obj_id0 = a.poid_id0 and
    c.rec_id = 0 and
    a.service_obj_type = '/service/ip' and
    a.poid_type = '/event/session/dialup' and
    b.termserv_id in ('62.231.255.21','62.231.255.22','62.231.255.23','62.231.255.24','62.231.255.25','62.231.255.26','62.231.255.27','62.231.255.28','62.231.255.29','62.231.255.30','62.231.255.31','62.231.255.32','62.231.255.33','62.231.255.34','62.231.255.35','62.231.255.36','62.231.255.37','62.231.255.38','62.231.255.39','62.231.255.40','62.231.255.43','62.231.255.44','62.231.255.255','ADSL-7301-Test','AKO2_ERX700','AZA1_ERX700','GHA1_ERX700','GMU4_ERX700','HMR1_ERX700','HMSQ_ERX700','KWR1_ERX700','MUS','MUS1_ERX700','MUT','MUT1_ERX700','MUTRAH-ERX','OMAN-ADSL-Test','QUR2_ERX700','Qur','SEB2_ERX700','TECH_BLDG','WAT1_ERX700','WKB1_ERX700','azaiba','TB-C10K-ADSL') and
    c.product_obj_id0 not in
    select poid_id0 from product_t
    where name like '%Cyber%'
    select
    substr (lpad(' ', level-1) || operation || ' (' || options || ')',1,30 ) "Operation",
    object_name "Object",
    partition_start, partition_stop
    from
    plan_table
    start with id = 0
    connect by prior id=parent_id;
    Operation Object PARTITION_START PARTITION_STOP
    SELECT STATEMENT ()
    SORT (AGGREGATE)
    FILTER ()
    NESTED LOOPS ()
    NESTED LOOPS ()
    PARTITION RANGE (ALL) 1 41
    TABLE ACCESS (BY LOCAL I EVENT_T 1 41
    INDEX (RANGE SCAN) I_EVENT__END_T 1 41
    PARTITION RANGE (ITERATOR KEY KEY
    TABLE ACCESS (BY LOCAL I EVENT_BAL_IMPACTS_T KEY KEY
    INDEX (RANGE SCAN) I_EVENT_BAL_IMPACTS__ID KEY KEY
    PARTITION RANGE (ITERATOR) KEY KEY
    TABLE ACCESS (BY LOCAL IN EVENT_SESSION_DIALUP_T KEY KEY
    INDEX (UNIQUE SCAN) I_EVENT_SESSION_DIALUP__ID KEY KEY
    TABLE ACCESS (FULL) PRODUCT_T
    explain plan for select 'Technical Building' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
    from event_bal_impacts_t c, event_session_dialup_t b, event_t a
    where
    end_t between date2unix(20060101000000) and date2unix(20060501000000) and
    b.obj_id0 = a.poid_id0 and
    c.obj_id0 = a.poid_id0 and
    c.rec_id = 0 and
    a.service_obj_type = '/service/ip' and
    a.poid_type = '/event/session/dialup' and
    b.termserv_id in ('62.231.255.21','62.231.255.22','62.231.255.23','62.231.255.24','62.231.255.25','62.231.255.26','62.231.255.27','62.231.255.28','62.231.255.29','62.231.255.30','62.231.255.31','62.231.255.32','62.231.255.33','62.231.255.34','62.231.255.35','62.231.255.36','62.231.255.37','62.231.255.38','62.231.255.39','62.231.255.40','62.231.255.43','62.231.255.44','62.231.255.255','ADSL-7301-Test','AKO2_ERX700','AZA1_ERX700','GHA1_ERX700','GMU4_ERX700','HMR1_ERX700','HMSQ_ERX700','KWR1_ERX700','MUS','MUS1_ERX700','MUT','MUT1_ERX700','MUTRAH-ERX','OMAN-ADSL-Test','QUR2_ERX700','Qur','SEB2_ERX700','TECH_BLDG','WAT1_ERX700','WKB1_ERX700','azaiba','TB-C10K-ADSL') and
    c.product_obj_id0 not in
    select poid_id0 from product_t
    where name like '%Cyber%'
    select
    substr (lpad(' ', level-1) || operation || ' (' || options || ')',1,30 ) "Operation",
    object_name "Object",
    partition_start, partition_stop
    from
    plan_table
    start with id = 0
    connect by prior id=parent_id;
    Operation Object PARTITION_START PARTITION_STOP
    SELECT STATEMENT ()
    SORT (AGGREGATE)
    FILTER ()
    NESTED LOOPS ()
    NESTED LOOPS ()
    PARTITION RANGE (ALL) 1 41
    TABLE ACCESS (BY LOCAL I EVENT_T 1 41
    INDEX (RANGE SCAN) I_EVENT__END_T 1 41
    PARTITION RANGE (ITERATOR KEY KEY
    TABLE ACCESS (BY LOCAL I EVENT_BAL_IMPACTS_T KEY KEY
    INDEX (RANGE SCAN) I_EVENT_BAL_IMPACTS__ID KEY KEY
    PARTITION RANGE (ITERATOR) KEY KEY
    TABLE ACCESS (BY LOCAL IN EVENT_SESSION_DIALUP_T KEY KEY
    INDEX (UNIQUE SCAN) I_EVENT_SESSION_DIALUP__ID KEY KEY
    TABLE ACCESS (FULL) PRODUCT_T
    spool create_event_view.lst
    set timing on
    create view event_t_view as (select * from event_t where end_t between date2unix('20060701000000') and date2unix('20061001000000'))
    spool off
    set serveroutput on size 1000000
    set timing on
    set linesize 132
    spool ABCReports51_new_1.lst
    declare
    m_report_year number(8);
    v_start varchar(38);
    v_end varchar(38);
    -- Fetch all Session Events for Non CyberCafe (Only IP Service) Product Events
    cursor SessionUsagePOP1(v_start varchar, v_end varchar) is
    select 'Technical Building' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
    from event_bal_impacts_t c, event_session_dialup_t b, event_t a
    where
    end_t between date2unix(v_start) and date2unix(v_end) and
    b.obj_id0 = a.poid_id0 and
    c.obj_id0 = a.poid_id0 and
    c.rec_id = 0 and
    a.service_obj_type = '/service/ip' and
    a.poid_type = '/event/session/dialup' and
    b.termserv_id in ('62.231.255.21','62.231.255.22','62.231.255.23','62.231.255.24','62.231.255.25','62.231.255.26','62.231.255.27','62.231.255.28','62.231.255.29','62.231.255.30','62.231.255.31','62.231.255.32','62.231.255.33','62.231.255.34','62.231.255.35','62.231.255.36','62.231.255.37','62.231.255.38','62.231.255.39','62.231.255.40','62.231.255.43','62.231.255.44','62.231.255.255','ADSL-7301-Test','AKO2_ERX700','AZA1_ERX700','GHA1_ERX700','GMU4_ERX700','HMR1_ERX700','HMSQ_ERX700','KWR1_ERX700','MUS','MUS1_ERX700','MUT','MUT1_ERX700','MUTRAH-ERX','OMAN-ADSL-Test','QUR2_ERX700','Qur','SEB2_ERX700','TECH_BLDG','WAT1_ERX700','WKB1_ERX700','azaiba','TB-C10K-ADSL') and
    c.product_obj_id0 not in
    select poid_id0 from product_t
    where name like '%Cyber%'
    cursor SessionUsagePOP2(v_start varchar, v_end varchar) is
    select 'Training Center' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
    from event_bal_impacts_t c, event_session_dialup_t b, event_t a
    where
    end_t between date2unix(v_start) and date2unix(v_end) and
    b.obj_id0 = a.poid_id0 and
    c.obj_id0 = a.poid_id0 and
    c.rec_id = 0 and
    a.service_obj_type = '/service/ip' and
    a.poid_type = '/event/session/dialup' and
    b.termserv_id in ('62.231.255.224','62.231.255.225','62.231.255.226','62.231.255.227','62.231.255.228','TRG-10K-ADSL') and
    c.product_obj_id0 not in
    select poid_id0 from product_t
    where name like '%Cyber%'
    cursor SessionUsagePOP3(v_start varchar, v_end varchar) is
    select 'Al-Khuwair' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
    from event_bal_impacts_t c, event_session_dialup_t b, event_t a
    where
    end_t between date2unix(v_start) and date2unix(v_end) and
    b.obj_id0 = a.poid_id0 and
    c.obj_id0 = a.poid_id0 and
    c.rec_id = 0 and
    a.service_obj_type = '/service/ip' and
    a.poid_type = '/event/session/dialup' and
    b.termserv_id in ('62.231.255.208') and
    c.product_obj_id0 not in
    select poid_id0 from product_t
    where name like '%Cyber%'
    cursor SessionUsagePOP4(v_start varchar, v_end varchar) is
    select 'Sallalah' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
    from event_bal_impacts_t c, event_session_dialup_t b, event_t a
    where
    end_t between date2unix(v_start) and date2unix(v_end) and
    b.obj_id0 = a.poid_id0 and
    c.obj_id0 = a.poid_id0 and
    c.rec_id = 0 and
    a.service_obj_type = '/service/ip' and
    a.poid_type = '/event/session/dialup' and
    b.termserv_id in ('62.231.192.20','62.231.192.21','62.231.192.22','62.231.255.132','62.231.255.133','62.231.255.134','SAL-10K-ADSL') and
    c.product_obj_id0 not in
    select poid_id0 from product_t
    where name like '%Cyber%'
    cursor SessionUsagePOP5(v_start varchar, v_end varchar) is
    select 'Sohar' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
    from event_bal_impacts_t c, event_session_dialup_t b, event_t a
    where
    end_t between date2unix(v_start) and date2unix(v_end) and
    b.obj_id0 = a.poid_id0 and
    c.obj_id0 = a.poid_id0 and
    c.rec_id = 0 and
    a.service_obj_type = '/service/ip' and
    a.poid_type = '/event/session/dialup' and
    b.termserv_id in ('62.231.200.20','62.231.200.21','62.231.255.148','62.231.255.149','SOH-10K-ADSL') and
    c.product_obj_id0 not in
    select poid_id0 from product_t
    where name like '%Cyber%'
    cursor SessionUsagePOP6(v_start varchar, v_end varchar) is
    select 'Nizwa' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
    from event_bal_impacts_t c, event_session_dialup_t b, event_t a
    where
    end_t between date2unix(v_start) and date2unix(v_end) and
    b.obj_id0 = a.poid_id0 and
    c.obj_id0 = a.poid_id0 and
    c.rec_id = 0 and
    a.service_obj_type = '/service/ip' and
    a.poid_type = '/event/session/dialup' and
    b.termserv_id in ('62.231.216.20','62.231.255.180','62.231.255.181','NIZ-10K-ADSL') and
    c.product_obj_id0 not in
    select poid_id0 from product_t
    where name like '%Cyber%'
    cursor SessionUsagePOP7(v_start varchar, v_end varchar) is
    select 'Masirah' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
    from event_bal_impacts_t c, event_session_dialup_t b, event_t a
    where
    end_t between date2unix(v_start) and date2unix(v_end) and
    b.obj_id0 = a.poid_id0 and
    c.obj_id0 = a.poid_id0 and
    c.rec_id = 0 and
    a.service_obj_type = '/service/ip' and
    a.poid_type = '/event/session/dialup' and
    b.termserv_id in ('212.72.13.41') and
    c.product_obj_id0 not in
    select poid_id0 from product_t
    where name like '%Cyber%'
    cursor SessionUsagePOP8(v_start varchar, v_end varchar) is
    select 'Ibri' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
    from event_bal_impacts_t c, event_session_dialup_t b, event_t a
    where
    end_t between date2unix(v_start) and date2unix(v_end) and
    b.obj_id0 = a.poid_id0 and
    c.obj_id0 = a.poid_id0 and
    c.rec_id = 0 and
    a.service_obj_type = '/service/ip' and
    a.poid_type = '/event/session/dialup' and
    b.termserv_id in ('62.231.224.20') and
    c.product_obj_id0 not in
    select poid_id0 from product_t
    where name like '%Cyber%'
    cursor SessionUsagePOP9(v_start varchar, v_end varchar) is
    select 'Sur' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
    from event_bal_impacts_t c, event_session_dialup_t b, event_t a
    where
    end_t between date2unix(v_start) and date2unix(v_end) and
    b.obj_id0 = a.poid_id0 and
    c.obj_id0 = a.poid_id0 and
    c.rec_id = 0 and
    a.service_obj_type = '/service/ip' and
    a.poid_type = '/event/session/dialup' and
    b.termserv_id in ('62.231.255.164','SUR-10K-ADSL') and
    c.product_obj_id0 not in
    select poid_id0 from product_t
    where name like '%Cyber%'
    cursor SessionUsagePOP10(v_start varchar, v_end varchar) is
    select 'Buraimi' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
    from event_bal_impacts_t c, event_session_dialup_t b, event_t a
    where
    end_t between date2unix(v_start) and date2unix(v_end) and
    b.obj_id0 = a.poid_id0 and
    c.obj_id0 = a.poid_id0 and
    c.rec_id = 0 and
    a.service_obj_type = '/service/ip' and
    a.poid_type = '/event/session/dialup' and
    b.termserv_id in ('BR-10K-ADSL') and
    c.product_obj_id0 not in
    select poid_id0 from product_t
    where name like '%Cyber%'
    begin
    m_report_year := 2006;
    v_start:='20060701000000';
    v_end:='20061001000000';
    /** Dialup Accounts Usage on each month **/
    dbms_output.put_line('Dialup Accounts Usage on each month during the Year ' || m_report_year);
    dbms_output.put_line('POP Name MM-YYYY No. of Seconds Avg. No. of Seconds');
    for c1 in 7..9
    loop <<c1_loop>>
    for c11 in SessionUsagePOP1(
    m_report_year || lpad(c1, 2, '0') || '01000000',
    m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
    loop <<c11_loop>>
    dbms_output.put_line(
    rpad(c11.PopName,25, ' ') || ' ' ||
    to_char(c1, '00') || '-' ||
    m_report_year || ' ' ||
    to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
    to_char(c11.AvgSec,'999,999,999.999')
    end loop c11_loop;
    end loop c1_loop;
    for c1 in 7..9
    loop <<c1_loop>>
    for c11 in SessionUsagePOP2(
    m_report_year || lpad(c1, 2, '0') || '01000000',
    m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
    loop <<c11_loop>>
    dbms_output.put_line(
    rpad(c11.PopName,25, ' ') || ' ' ||
    to_char(c1, '00') || '-' ||
    m_report_year || ' ' ||
    to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
    to_char(c11.AvgSec,'999,999,999.999')
    end loop c11_loop;
    end loop c1_loop;
    for c1 in 7..9
    loop <<c1_loop>>
    for c11 in SessionUsagePOP3(
    m_report_year || lpad(c1, 2, '0') || '01000000',
    m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
    loop <<c11_loop>>
    dbms_output.put_line(
    rpad(c11.PopName,25, ' ') || ' ' ||
    to_char(c1, '00') || '-' ||
    m_report_year || ' ' ||
    to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
    to_char(c11.AvgSec,'999,999,999.999')
    end loop c11_loop;
    end loop c1_loop;
    for c1 in 7..9
    loop <<c1_loop>>
    for c11 in SessionUsagePOP4(
    m_report_year || lpad(c1, 2, '0') || '01000000',
    m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
    loop <<c11_loop>>
    dbms_output.put_line(
    rpad(c11.PopName,25, ' ') || ' ' ||
    to_char(c1, '00') || '-' ||
    m_report_year || ' ' ||
    to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
    to_char(c11.AvgSec,'999,999,999.999')
    end loop c11_loop;
    end loop c1_loop;
    for c1 in 7..9
    loop <<c1_loop>>
    for c11 in SessionUsagePOP5(
    m_report_year || lpad(c1, 2, '0') || '01000000',
    m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
    loop <<c11_loop>>
    dbms_output.put_line(
    rpad(c11.PopName,25, ' ') || ' ' ||
    to_char(c1, '00') || '-' ||
    m_report_year || ' ' ||
    to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
    to_char(c11.AvgSec,'999,999,999.999')
    end loop c11_loop;
    end loop c1_loop;
    for c1 in 7..9
    loop <<c1_loop>>
    for c11 in SessionUsagePOP6(
    m_report_year || lpad(c1, 2, '0') || '01000000',
    m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
    loop <<c11_loop>>
    dbms_output.put_line(
    rpad(c11.PopName,25, ' ') || ' ' ||
    to_char(c1, '00') || '-' ||
    m_report_year || ' ' ||
    to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
    to_char(c11.AvgSec,'999,999,999.999')
    end loop c11_loop;
    end loop c1_loop;
    for c1 in 7..9
    loop <<c1_loop>>
    for c11 in SessionUsagePOP7(
    m_report_year || lpad(c1, 2, '0') || '01000000',
    m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
    loop <<c11_loop>>
    dbms_output.put_line(
    rpad(c11.PopName,25, ' ') || ' ' ||
    to_char(c1, '00') || '-' ||
    m_report_year || ' ' ||
    to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
    to_char(c11.AvgSec,'999,999,999.999')
    end loop c11_loop;
    end loop c1_loop;
    for c1 in 7..9
    loop <<c1_loop>>
    for c11 in SessionUsagePOP8(
    m_report_year || lpad(c1, 2, '0') || '01000000',
    m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
    loop <<c11_loop>>
    dbms_output.put_line(
    rpad(c11.PopName,25, ' ') || ' ' ||
    to_char(c1, '00') || '-' ||
    m_report_year || ' ' ||
    to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
    to_char(c11.AvgSec,'999,999,999.999')
    end loop c11_loop;
    end loop c1_loop;
    for c1 in 7..9
    loop <<c1_loop>>
    for c11 in SessionUsagePOP9(
    m_report_year || lpad(c1, 2, '0') || '01000000',
    m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
    loop <<c11_loop>>
    dbms_output.put_line(
    rpad(c11.PopName,25, ' ') || ' ' ||
    to_char(c1, '00') || '-' ||
    m_report_year || ' ' ||
    to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
    to_char(c11.AvgSec,'999,999,999.999')
    end loop c11_loop;
    end loop c1_loop;
    for c1 in 7..9
    loop <<c1_loop>>
    for c11 in SessionUsagePOP10(
    m_report_year || lpad(c1, 2, '0') || '01000000',
    m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
    loop <<c11_loop>>
    dbms_output.put_line(
    rpad(c11.PopName,25, ' ') || ' ' ||
    to_char(c1, '00') || '-' ||
    m_report_year || ' ' ||
    to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
    to_char(c11.AvgSec,'999,999,999.999')
    end loop c11_loop;
    end loop c1_loop;
    end;
    spool off
    Dialup Accounts Usage on each month during the Year 2006
    POP Name MM-YYYY No. of Seconds Avg. No. of Seconds
    Technical Building 07-2006 1,468,439,634 1,985.848
    Technical Building 08-2006 1,476,030,818 1,954.927
    Technical Building 09-2006 1,385,143,427 1,917.764
    Training Center 07-2006 19,481,275 2,193.343
    Training Center 08-2006 7,368,849 2,317.977
    Training Center 09-2006
    Al-Khuwair 07-2006 327,753,498 1,929.392
    Al-Khuwair 08-2006 326,043,930 1,867.751
    Al-Khuwair 09-2006 314,307,853 1,884.758
    Sallalah 07-2006 297,238,088 2,127.765
    Sallalah 08-2006 291,646,501 2,049.130
    Sallalah 09-2006 256,812,968 2,050.403
    Sohar 07-2006 499,669,759 2,002.588
    Sohar 08-2006 517,602,784 1,996.208
    Sohar 09-2006 460,677,766 1,965.760
    Nizwa 07-2006 313,445,474 1,804.896
    Nizwa 08-2006 336,749,026 1,820.708
    Nizwa 09-2006 279,534,466 1,809.074
    Masirah 07-2006 17,417,301 2,315.822
    Masirah 08-2006 20,053,961 2,791.087
    Masirah 09-2006 17,225,347 2,656.593
    Ibri 07-2006
    Ibri 08-2006
    Ibri 09-2006
    Sur 07-2006 146,555,060 1,765.681
    Sur 08-2006 148,694,745 1,710.157
    Sur 09-2006 138,260,990 1,687.962
    Buraimi 07-2006
    Buraimi 08-2006
    Buraimi 09-2006
    PL/SQL procedure successfully completed.
    Elapsed: 14:27:26.17
    set serveroutput on size 1000000
    set timing on
    set linesize 132
    spool ABCReports51_new.lst
    declare
    m_report_year number(8);
    v_start varchar(38);
    v_end varchar(38);
    -- Fetch all Session Events for Non CyberCafe (Only IP Service) Product Events
    cursor SessionUsagePOP1(v_start varchar, v_end varchar) is
    select 'Technical Building' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
    from event_bal_impacts_t c, event_session_dialup_t b, event_t_view a
    where
    end_t between date2unix(v_start) and date2unix(v_end) and
    b.obj_id0 = a.poid_id0 and
    c.obj_id0 = a.poid_id0 and
    c.rec_id = 0 and
    a.service_obj_type = '/service/ip' and
    a.poid_type = '/event/session/dialup' and
    b.termserv_id in ('62.231.255.21','62.231.255.22','62.231.255.23','62.231.255.24','62.231.255.25','62.231.255.26','62.231.255.27','62.231.255.28','62.231.255.29','62.231.255.30','62.231.255.31','62.231.255.32','62.231.255.33','62.231.255.34','62.231.255.35','62.231.255.36','62.231.255.37','62.231.255.38','62.231.255.39','62.231.255.40','62.231.255.43','62.231.255.44','62.231.255.255','ADSL-7301-Test','AKO2_ERX700','AZA1_ERX700','GHA1_ERX700','GMU4_ERX700','HMR1_ERX700','HMSQ_ERX700','KWR1_ERX700','MUS','MUS1_ERX700','MUT','MUT1_ERX700','MUTRAH-ERX','OMAN-ADSL-Test','QUR2_ERX700','Qur','SEB2_ERX700','TECH_BLDG','WAT1_ERX700','WKB1_ERX700','azaiba','TB-C10K-ADSL') and
    c.product_obj_id0 not in
    select poid_id0 from product_t
    where name like '%Cyber%'
    cursor SessionUsagePOP2(v_start varchar, v_end varchar) is
    select 'Training Center' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
    from event_bal_impacts_t c, event_session_dialup_t b, event_t_view a
    where
    end_t between date2unix(v_start) and date2unix(v_end) and
    b.obj_id0 = a.poid_id0 and
    c.obj_id0 = a.poid_id0 and
    c.rec_id = 0 and
    a.service_obj_type = '/service/ip' and
    a.poid_type = '/event/session/dialup' and
    b.termserv_id in ('62.231.255.224','62.231.255.225','62.231.255.226','62.231.255.227','62.231.255.228','TRG-10K-ADSL') and
    c.product_obj_id0 not in
    select poid_id0 from product_t
    where name like '%Cyber%'
    cursor SessionUsagePOP3(v_start varchar, v_end varchar) is
    select 'Al-Khuwair' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
    from event_bal_impacts_t c, event_session_dialup_t b, event_t_view a
    where
    end_t between date2unix(v_start) and date2unix(v_end) and
    b.obj_id0 = a.poid_id0 and
    c.obj_id0 = a.poid_id0 and
    c.rec_id = 0 and
    a.service_obj_type = '/service/ip' and
    a.poid_type = '/event/session/dialup' and
    b.termserv_id in ('62.231.255.208') and
    c.product_obj_id0 not in
    select poid_id0 from product_t
    where name like '%Cyber%'
    cursor SessionUsagePOP4(v_start varchar, v_end varchar) is
    select 'Sallalah' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
    from event_bal_impacts_t c, event_session_dialup_t b, event_t_view a
    where
    end_t between date2unix(v_start) and date2unix(v_end) and
    b.obj_id0 = a.poid_id0 and
    c.obj_id0 = a.poid_id0 and
    c.rec_id = 0 and
    a.service_obj_type = '/service/ip' and
    a.poid_type = '/event/session/dialup' and
    b.termserv_id in ('62.231.192.20','62.231.192.21','62.231.192.22','62.231.255.132','62.231.255.133','62.231.255.134','SAL-10K-ADSL') and
    c.product_obj_id0 not in
    select poid_id0 from product_t
    where name like '%Cyber%'
    cursor SessionUsagePOP5(v_start varchar, v_end varchar) is
    select 'Sohar' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
    from event_bal_impacts_t c, event_session_dialup_t b, event_t_view a
    where
    end_t between date2unix(v_start) and date2unix(v_end) and
    b.obj_id0 = a.poid_id0 and
    c.obj_id0 = a.poid_id0 and
    c.rec_id = 0 and
    a.service_obj_type = '/service/ip' and
    a.poid_type = '/event/session/dialup' and
    b.termserv_id in ('62.231.200.20','62.231.200.21','62.231.255.148','62.231.255.149','SOH-10K-ADSL') and
    c.product_obj_id0 not in
    select poid_id0 from product_t
    where name like '%Cyber%'
    cursor SessionUsagePOP6(v_start varchar, v_end varchar) is
    select 'Nizwa' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
    from event_bal_impacts_t c, event_session_dialup_t b, event_t_view a
    where
    end_t between date2unix(v_start) and date2unix(v_end) and
    b.obj_id0 = a.poid_id0 and
    c.obj_id0 = a.poid_id0 and
    c.rec_id = 0 and
    a.service_obj_type = '/service/ip' and
    a.poid_type = '/event/session/dialup' and
    b.termserv_id in ('62.231.216.20','62.231.255.180','62.231.255.181','NIZ-10K-ADSL') and
    c.product_obj_id0 not in
    select poid_id0 from product_t
    where name like '%Cyber%'
    cursor SessionUsagePOP7(v_start varchar, v_end varchar) is
    select 'Masirah' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
    from event_bal_impacts_t c, event_session_dialup_t b, event_t_view a
    where
    end_t between date2unix(v_start) and date2unix(v_end) and
    b.obj_id0 = a.poid_id0 and
    c.obj_id0 = a.poid_id0 and
    c.rec_id = 0 and
    a.service_obj_type = '/service/ip' and
    a.poid_type = '/event/session/dialup' and
    b.termserv_id in ('212.72.13.41') and
    c.product_obj_id0 not in
    select poid_id0 from product_t
    where name like '%Cyber%'
    cursor SessionUsagePOP8(v_start varchar, v_end varchar) is
    select 'Ibri' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
    from event_bal_impacts_t c, event_session_dialup_t b, event_t_view a
    where
    end_t between date2unix(v_start) and date2unix(v_end) and
    b.obj_id0 = a.poid_id0 and
    c.obj_id0 = a.poid_id0 and
    c.rec_id = 0 and
    a.service_obj_type = '/service/ip' and
    a.poid_type = '/event/session/dialup' and
    b.termserv_id in ('62.231.224.20') and
    c.product_obj_id0 not in
    select poid_id0 from product_t
    where name like '%Cyber%'
    cursor SessionUsagePOP9(v_start varchar, v_end varchar) is
    select 'Sur' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
    from event_bal_impacts_t c, event_session_dialup_t b, event_t_view a
    where
    end_t between date2unix(v_start) and date2unix(v_end) and
    b.obj_id0 = a.poid_id0 and
    c.obj_id0 = a.poid_id0 and
    c.rec_id = 0 and
    a.service_obj_type = '/service/ip' and
    a.poid_type = '/event/session/dialup' and
    b.termserv_id in ('62.231.255.164','SUR-10K-ADSL') and
    c.product_obj_id0 not in
    select poid_id0 from product_t
    where name like '%Cyber%'
    cursor SessionUsagePOP10(v_start varchar, v_end varchar) is
    select 'Buraimi' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
    from event_bal_impacts_t c, event_session_dialup_t b, event_t_view a
    where
    end_t between date2unix(v_start) and date2unix(v_end) and
    b.obj_id0 = a.poid_id0 and
    c.obj_id0 = a.poid_id0 and
    c.rec_id = 0 and
    a.service_obj_type = '/service/ip' and
    a.poid_type = '/event/session/dialup' and
    b.termserv_id in ('BR-10K-ADSL') and
    c.product_obj_id0 not in
    select poid_id0 from product_t
    where name like '%Cyber%'
    begin
    m_report_year := 2006;
    v_start:='20060701000000';
    v_end:='20061001000000';
    /** Dialup Accounts Usage on each month **/
    dbms_output.put_line('Dialup Accounts Usage on each month during the Year ' || m_report_year);
    dbms_output.put_line('POP Name MM-YYYY No. of Seconds Avg. No. of Seconds');
    for c1 in 7..9
    loop <<c1_loop>>
    for c11 in SessionUsagePOP1(
    m_report_year || lpad(c1, 2, '0') || '01000000',
    m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
    loop <<c11_loop>>
    dbms_output.put_line(
    rpad(c11.PopName,25, ' ') || ' ' ||
    to_char(c1, '00') || '-' ||
    m_report_year || ' ' ||
    to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
    to_char(c11.AvgSec,'999,999,999.999')
    end loop c11_loop;
    end loop c1_loop;
    for c1 in 7..9
    loop <<c1_loop>>
    for c11 in SessionUsagePOP2(
    m_report_year || lpad(c1, 2, '0') || '01000000',
    m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
    loop <<c11_loop>>
    dbms_output.put_line(
    rpad(c11.PopName,25, ' ') || ' ' ||
    to_char(c1, '00') || '-' ||
    m_report_year || ' ' ||
    to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
    to_char(c11.AvgSec,'999,999,999.999')
    end loop c11_loop;
    end loop c1_loop;
    for c1 in 7..9
    loop <<c1_loop>>
    for c11 in SessionUsagePOP3(
    m_report_year || lpad(c1, 2, '0') || '01000000',
    m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
    loop <<c11_loop>>
    dbms_output.put_line(
    rpad(c11.PopName,25, ' ') || ' ' ||
    to_char(c1, '00') || '-' ||
    m_report_year || ' ' ||
    to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
    to_char(c11.AvgSec,'999,999,999.999')
    end loop c11_loop;
    end loop c1_loop;
    for c1 in 7..9
    loop <<c1_loop>>
    for c11 in SessionUsagePOP4(
    m_report_year || lpad(c1, 2, '0') || '01000000',
    m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
    loop <<c11_loop>>
    dbms_output.put_line(
    rpad(c11.PopName,25, ' ') || ' ' ||
    to_char(c1, '00') || '-' ||
    m_report_year || ' ' ||
    to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
    to_char(c11.AvgSec,'999,999,999.999')
    end loop c11_loop;
    end loop c1_loop;
    for c1 in 7..9
    loop <<c1_loop>>
    for c11 in SessionUsagePOP5(
    m_report_year || lpad(c1, 2, '0') || '01000000',
    m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
    loop <<c11_loop>>
    dbms_output.put_line(
    rpad(c11.PopName,25, ' ') || ' ' ||
    to_char(c1, '00') || '-' ||
    m_report_year || ' ' ||
    to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
    to_char(c11.AvgSec,'999,999,999.999')
    end loop c11_loop;
    end loop c1_loop;
    for c1 in 7..9
    loop <<c1_loop>>
    for c11 in SessionUsagePOP6(
    m_report_year || lpad(c1, 2, '0') || '01000000',
    m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
    loop <<c11_loop>>
    dbms_output.put_line(
    rpad(c11.PopName,25, ' ') || ' ' ||
    to_char(c1, '00') || '-' ||
    m_report_year || ' ' ||
    to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
    to_char(c11.AvgSec,'999,999,999.999')
    end loop c11_loop;
    end loop c1_loop;
    for c1 in 7..9
    loop <<c1_loop>>
    for c11 in SessionUsagePOP7(
    m_report_year || lpad(c1, 2, '0') || '01000000',
    m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
    loop <<c11_loop>>
    dbms_output.put_line(
    rpad(c11.PopName,25, ' ') || ' ' ||
    to_char(c1, '00') || '-' ||
    m_report_year || ' ' ||
    to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
    to_char(c11.AvgSec,'999,999,999.999')
    end loop c11_loop;
    end loop c1_loop;
    for c1 in 7..9
    loop <<c1_loop>>
    for c11 in SessionUsagePOP8(
    m_report_year || lpad(c1, 2, '0') || '01000000',
    m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
    loop <<c11_loop>>
    dbms_output.put_line(
    rpad(c11.PopName,25, ' ') || ' ' ||
    to_char(c1, '00') || '-' ||
    m_report_year || ' ' ||
    to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
    to_char(c11.AvgSec,'999,999,999.999')
    end loop c11_loop;
    end loop c1_loop;
    for c1 in 7..9
    loop <<c1_loop>>
    for c11 in SessionUsagePOP9(
    m_report_year || lpad(c1, 2, '0') || '01000000',
    m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
    loop <<c11_loop>>
    dbms_output.put_line(
    rpad(c11.PopName,25, ' ') || ' ' ||
    to_char(c1, '00') || '-' ||
    m_report_year || ' ' ||
    to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
    to_char(c11.AvgSec,'999,999,999.999')
    end loop c11_loop;
    end loop c1_loop;
    for c1 in 7..9
    loop <<c1_loop>>
    for c11 in SessionUsagePOP10(
    m_report_year || lpad(c1, 2, '0') || '01000000',
    m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
    loop <<c11_loop>>
    dbms_output.put_line(
    rpad(c11.PopName,25, ' ') || ' ' ||
    to_char(c1, '00') || '-' ||
    m_report_year || ' ' ||
    to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
    to_char(c11.AvgSec,'999,999,999.999')
    end loop c11_loop;
    end loop c1_loop;
    end;
    spool off

  • Update query in sql taking more time

    Hi
    I am running an update query which takeing more time any help to run this fast.
    update arm538e_tmp t
    set t.qtr5 =(select (sum(nvl(m.net_sales_value,0))/1000) from mnthly_sales_actvty m
    where m.vndr#=t.vndr#
    and m.cust_type_cd=t.cust_type
    and m.cust_type_cd<>13
    and m.yymm between 201301 and 201303
    group by m.vndr#,m.cust_type_cd;
    help will be appreciable
    thank you

    This is the Reports forum. Ask this in the SQL and PL/SQL forum.

  • BSAD table is taking more time in select query.

    Hi ,
    The below SELECT query is taking more time , there is no any secondary index is there .
    Can anybody suggest how to improve it .
    SELECT bukrs
             kunnr
             augdt
             augbl
             gjahr
             belnr
             budat
             bldat
             waers
             xblnr
             BLART
             monat
             shkzg
             gsber
             DMBTR
             WRBTR
             prctr
             FROM  BSAD INTO TABLE gt_bsad
             WHERE  bukrs  = p_bukrs
             AND    kunnr  IN so_kunnr
             AND    budat  IN so_budat
             AND    xblnr  IN so_xblnr
             AND  ( blart  EQ 'DA' OR
                    blart  EQ 'DZ' OR
                    blart  EQ 'ZP' OR               "D03K904574
                    blart  EQ 'KZ' OR               "D03K904574
                    blart  EQ 'DP' )
             AND   PRCTR IN R_PC.
    Thanks in advance
    Regards
    chetan

    Hi Chetan ,
    I will suggest you two things :
    1. Try to add Secondary ( Non-unique) index on table BSAD with fields : mandt,bukrs,kunnr,budat,xblnr,blart,prctr.
        but before adding this index test the selectivity of this index by going to Tcode DB05
    2. In the select query you have used OR condition for blart. Instead of this try to create a ranges table for blart and append the  values 'DA','DZ','ZP','KZ','DP' and use this in the select query. This will improve the performance for sure.
    Hope this will help to ypu.
    Regards,
    Nikhil

  • INSTR() function is taking more time

    im using the below query select query in my procedure.
    select distinct SUPPLIER_CIRCUIT_ID from SUPPLIER_DATA
    where INSTR(i.SYSTEM_CIRCUIT_ID,SUPPLIER_CIRCUIT_ID) > 0;
    I am taking SYSTEM_CIRCUIT_ID in cursor.
    This query is taking more time. Is that possiblt to create function based index and speed up the query?

    Hi,
    Welcome to the forum!
    993620 wrote:
    im using the below query select query in my procedure.
    select distinct SUPPLIER_CIRCUIT_ID from SUPPLIER_DATA
    where INSTR(i.SYSTEM_CIRCUIT_ID,SUPPLIER_CIRCUIT_ID) > 0;
    I am taking SYSTEM_CIRCUIT_ID in cursor.Show exactly what you're doing.
    Whenever you have a problem, post a complete test script that people can run to re-create the problem and test their ideas.
    See te forum FAQ {message:id=9360002}
    This query is taking more time. Is that possiblt to create function based index and speed up the query?Sorry, unless you doing something very specific (such as alwyas looking for the same sub-string) then a function-based index won't help.
    Oracle sells a separate product, called Oracle Text, for this kind of searching.
    You might try LIKE:
    WHERE  i.SYSTEM_CIRCUIT_ID LIKE  '%' || SUPPLIER_CIRCUIT_ID || '%'If you're using a cursor, then that's probably slowing the process down much more than the part you're showing.

  • After creating index query is taking more

    Hello all,
    I am trying the following..and not getting why the query is taking more time after creating the index
    SQL> SELECT distinct version_no
    2 FROM iefloa_data_anal
    3 WHERE datetime_inserted > to_date('17-02-2004','dd-mm-yyyy');
    VERSION_NO
    999
    Elapsed: 00:00:22.16
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=15 Card=1 Bytes=22)
    1 0 SORT (UNIQUE) (Cost=15 Card=1 Bytes=22)
    2 1 TABLE ACCESS (FULL) OF 'IEFLOA_DATA_ANAL' (Cost=2 Card=1
    Bytes=22)
    /*******************Here I am creating the Index************/
    SQL> create index t_ind_date on iefloa_data_anal(datetime_inserted);
    Index created.
    Elapsed: 00:07:427.38
    SQL> SELECT distinct version_no
    2 FROM iefloa_data_anal
    3 WHERE datetime_inserted > to_date('17-02-2004','dd-mm-yyyy');
    VERSION_NO
    999
    Elapsed: 00:00:40.10
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=14 Card=1 Bytes=22)
    1 0 SORT (UNIQUE) (Cost=14 Card=1 Bytes=22)
    2 1 TABLE ACCESS (BY INDEX ROWID) OF 'IEFLOA_DATA_ANAL' (Cos
    t=1 Card=1 Bytes=22)
    3 2 INDEX (RANGE SCAN) OF 'T_IND_DATE' (NON-UNIQUE) (Cost=
    1 Card=1)
    can anybody explains whats the reason...
    the table is having around 1.5 crore records
    regards

    The execution plan clearly shows that Oracle thinks only one row is going to match that condition on the index ("Card=1"). Is that a true statement? If not, you should make sure your stats are accurate. If the data is highly skewed, you may need to put a histogram on that column.
    Another possibility is that the index is on much slower disks than the table. Although, I can't imagine any range scan on an index that has only one matching value taking that long. How about doing a full trace (SET AUTOTRACE ON) and posting the logical and physical i/o information?

  • Quesry taking more time to execute

    Dear All,
    User complained that his query is taking more time than yesterday and DB performance is also very slow, so what would be your strategy to check and fix the problem.
    What could be the right approach to check and fix this.
    Regards,
    DevD!
    Edited by: user12138514 on Nov 8, 2009 9:35 PM

    And here is the cause list for slow performance:
    Slow Network connection.
    Bad Connection management.
    Bad Use of Cursors and the Shared Pool
    Bad SQL or Query is not perfectly tune or not using bind variables.
    Use of nonstandard initialization parameters.
    Getting Database I/O Wrong
    Redo Log Setup Problems
    Serialization of data blocks in the buffer cache due to lack of free lists, free list groups, transaction slots (INITRANS), or shortage of rollback segments.
    Long Full Table Scans.
    High Amounts of Recursive (SYS) SQL
    Deployment and Migration Errors
    Table require analyzed.
    Table require indexed.
    Overparsing.
    You have old discs.
    Not enough memory.
    SGA is too small or too big.
    Same for cache buffer.
    Your OS need tuning.
    Your disc is full.
    Running so many instances on a single server.
    You applications are badly written.
    Your applications were ported from Sybase or Microsoft SQL Server.
    Your applications were ported from DB2.
    Your applications dynamically create temp tables.
    Someone wrote referential integrity using triggers, java, vb ...
    Someone wrote replication using triggers, java, vb ...
    Someone wrote a sequence using max + 1.
    Table datatypes are not as per DBMS concepts; like Dates and numbers are stored as strings.
    The statistics are not up to date.
    There are no statistics.
    What are statistics?
    We are using RBO.
    That's a few of the possible causes I could think of, there are lots of others.
    -To analyze your application, you can install Statspack. It will give you some indications.
    Hth
    Girish Sharma

  • Child Query taking more time

    Dear Gurus/Masters/All,
    I request your valuble assistance in tuning one of my SQL.
    We are using oracle 10.2.04 version and OS is HP-UX 11.23(ia64) version
    In my production environment one SQL is taking more time to complete the task. According to EXPLAIN PLAN, i observed that one of it's WHERE condition execution is causing the issue.
    I took the explain plan of the WHERE condition which is causing the issue. It is going for full table scan to satisfy the criteria. But a normal index exists on this column.
    Main Query WHERE condition and Explain Plan.
    SELECT column list ....
    FROM
        SIEBEL.S_ADDR_PER T1,
        SIEBEL.S_PTY_PAY_PRFL T2,
        SIEBEL.S_INVLOC T3,
        SIEBEL.S_ORDER T4,
        SIEBEL.S_ORG_EXT T5,
        SIEBEL.S_POSTN T6,
        SIEBEL.S_PARTY T7,
        SIEBEL.S_PROJ T8,
        SIEBEL.S_CON_ADDR T9,
        SIEBEL.S_ORG_EXT T10,
        SIEBEL.S_USER T11,
        SIEBEL.S_DOC_QUOTE T12,
        SIEBEL.S_ACCNT_POSTN T13,
        SIEBEL.S_INS_CLAIM T14,
        SIEBEL.S_USER T15,
        SIEBEL.S_ORG_EXT T16,
        SIEBEL.S_ASSET T17,
        SIEBEL.S_ORDER_TNTX T18,
        SIEBEL.S_ORG_EXT_TNTX T19,
        SIEBEL.S_PERIOD T20,
        SIEBEL.S_DEPOSIT_TNT T21,
        SIEBEL.S_ADDR_PER T22,
        SIEBEL.S_PAYMENT_TERM T23,
        SIEBEL.S_ORG_EXT_X T24,
        SIEBEL.S_ORG_EXT T25,
        SIEBEL.S_INSCLM_ELMNT T26,
        SIEBEL.S_INVOICE T27
    WHERE
       T25.BU_ID = T10.PAR_ROW_ID (+) AND
       T26.INSCLM_ID = T14.ROW_ID (+) AND
       T27.ELEMENT_ID = T26.ROW_ID (+) AND
       T27.LAST_UPD_BY = T15.PAR_ROW_ID (+) AND
       T4.QUOTE_ID = T12.ROW_ID (+) AND
       T3.CG_ASSSET_ID = T17.ROW_ID (+) AND
       T27.BL_ADDR_ID = T22.ROW_ID (+) AND
       T8.BU_ID = T5.PAR_ROW_ID (+) AND
       T27.PER_PAY_PRFL_ID = T2.ROW_ID (+) AND
       T27.REMIT_ORG_EXT_ID = T16.PAR_ROW_ID (+) AND
       T27.PROJ_ID = T8.ROW_ID (+) AND
       T27.BL_PERIOD_ID = T20.ROW_ID (+) AND
       T27.PAYMENT_TERM_ID = T23.ROW_ID (+) AND
       T12.BU_ID = T19.PAR_ROW_ID (+) AND
       T27.ACCNT_ID = T25.PAR_ROW_ID (+) AND
       T27.ORDER_ID = T18.ROW_ID (+) AND
       T4.SRC_INVLOC_ID = T3.ROW_ID (+) AND
       T27.ORDER_ID = T4.ROW_ID (+) AND
       T27.ACCNT_ID = T24.PAR_ROW_ID (+) AND
       T18.PR_DEPOSIT_ID = T21.ROW_ID (+) AND
       T27.BL_ADDR_ID = T9.ADDR_PER_ID (+) AND T27.ACCNT_ID = T9.ACCNT_ID (+) AND
       T27.BL_ADDR_ID = T1.ROW_ID (+) AND
       T25.PR_POSTN_ID = T13.POSITION_ID (+) AND T25.ROW_ID = T13.OU_EXT_ID (+) AND
       T13.POSITION_ID = T7.ROW_ID (+) AND
       T13.POSITION_ID = T6.PAR_ROW_ID (+) AND
       T6.PR_EMP_ID = T11.PAR_ROW_ID (+) AND
       (T27.INVC_TYPE_CD = :1)
    ORDER BY
       T27.INVC_DT;
    Explained.
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 2576210427
    | Id  | Operation                                              | Name              | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                                       |                   |    39M|    71G|       |   624M  (1)|278:42:59 |
    |   1 |  SORT ORDER BY                                         |                   |    39M|    71G|   150G|   624M  (1)|278:42:59 |
    |   2 |   NESTED LOOPS OUTER                                   |                   |    39M|    71G|       |   610M  (1)|272:11:24 |
    |   3 |    NESTED LOOPS OUTER                                  |                   |    39M|    70G|       |   515M  (1)|229:48:41 |
    |   4 |     NESTED LOOPS OUTER                                 |                   |    39M|    69G|       |   483M  (1)|215:41:04 |
    |   5 |      NESTED LOOPS OUTER                                |                   |    39M|    68G|       |   483M  (1)|215:41:04 |
    |   6 |       NESTED LOOPS OUTER                               |                   |    39M|    67G|       |   483M  (1)|215:41:04 |
    |   7 |        NESTED LOOPS OUTER                              |                   |    39M|    66G|       |   406M  (1)|181:17:50 |
    |   8 |         NESTED LOOPS OUTER                             |                   |    39M|    65G|       |   343M  (1)|153:12:57 |
    |   9 |          NESTED LOOPS OUTER                            |                   |    39M|    64G|       |   311M  (1)|139:04:56 |
    |  10 |           NESTED LOOPS OUTER                           |                   |    39M|    63G|       |   185M  (1)| 82:37:56 |
    |  11 |            NESTED LOOPS OUTER                          |                   |    39M|    54G|       |   108M  (1)| 48:11:29 |
    |  12 |             NESTED LOOPS OUTER                         |                   |    39M|    53G|       |   108M  (1)| 48:11:29 |
    |  13 |              NESTED LOOPS OUTER                        |                   |    39M|    51G|       |    76M  (1)| 34:03:51 |
    |  14 |               NESTED LOOPS OUTER                       |                   |    39M|    49G|       |    76M  (1)| 34:03:51 |
    |  15 |                NESTED LOOPS OUTER                      |                   |    39M|    46G|       |    76M  (1)| 34:03:51 |
    |  16 |                 NESTED LOOPS OUTER                     |                   |    39M|    44G|       |    76M  (1)| 34:03:51 |
    |  17 |                  NESTED LOOPS OUTER                    |                   |    39M|    40G|       |    65M  (1)| 29:25:49 |
    |  18 |                   NESTED LOOPS OUTER                   |                   |    39M|    39G|       |    65M  (1)| 29:25:49 |
    |  19 |                    NESTED LOOPS OUTER                  |                   |    39M|    38G|       |    65M  (1)| 29:25:49 |
    |  20 |                     NESTED LOOPS OUTER                 |                   |    39M|    34G|       |    65M  (1)| 29:17:44 |
    |  21 |                      NESTED LOOPS OUTER                |                   |    39M|    32G|       |    65M  (1)| 29:17:08 |
    |  22 |                       NESTED LOOPS OUTER               |                   |    39M|    31G|       |    65M  (1)| 29:09:04 |
    |  23 |                        NESTED LOOPS OUTER              |                   |    39M|    30G|       |  2043K  (9)| 00:54:42 |
    |  24 |                         NESTED LOOPS OUTER             |                   |    39M|    30G|       |  2043K  (9)| 00:54:42 |
    |  25 |                          NESTED LOOPS OUTER            |                   |    39M|    25G|       |  2015K  (7)| 00:53:57 |
    |  26 |                           NESTED LOOPS OUTER           |                   |    39M|    22G|       |  2015K  (7)| 00:53:57 |
    |  27 |                            NESTED LOOPS OUTER          |                   |    39M|    16G|       |  2015K  (7)| 00:53:57 |
    |* 28 |                             TABLE ACCESS FULL          | S_INVOICE         |    39M|     9G|       |  2015K  (7)| 00:53:57 |
    |  29 |                             TABLE ACCESS BY INDEX ROWID| S_PROJ            |     1 |   188 |       |     1   (0)| 00:00:01 |
    |* 30 |                              INDEX UNIQUE SCAN         | S_PROJ_P1         |     1 |       |       |     1   (0)| 00:00:01 |
    |  31 |                            TABLE ACCESS BY INDEX ROWID | S_PAYMENT_TERM    |     1 |   156 |       |     1   (0)| 00:00:01 |
    |* 32 |                             INDEX UNIQUE SCAN          | S_PAYMENT_TERM_P1 |     1 |       |       |     1   (0)| 00:00:01 |
    |  33 |                           TABLE ACCESS BY INDEX ROWID  | S_INSCLM_ELMNT    |     1 |    77 |       |     1   (0)| 00:00:01 |
    |* 34 |                            INDEX UNIQUE SCAN           | S_INSCLM_ELMNT_P1 |     1 |       |       |     1   (0)| 00:00:01 |
    |  35 |                          TABLE ACCESS BY INDEX ROWID   | S_INS_CLAIM       |     1 |   134 |       |     1   (0)| 00:00:01 |
    |* 36 |                           INDEX UNIQUE SCAN            | S_INS_CLAIM_P1    |     1 |       |       |     1   (0)| 00:00:01 |
    |  37 |                         TABLE ACCESS BY INDEX ROWID    | S_PERIOD          |     1 |    19 |       |     1   (0)| 00:00:01 |
    |* 38 |                          INDEX UNIQUE SCAN             | S_PERIOD_P1       |     1 |       |       |     1   (0)| 00:00:01 |
    |  39 |                        TABLE ACCESS BY INDEX ROWID     | S_USER            |     1 |    25 |       |     2   (0)| 00:00:01 |
    |* 40 |                         INDEX UNIQUE SCAN              | S_USER_U2         |     1 |       |       |     1   (0)| 00:00:01 |
    |  41 |                       TABLE ACCESS BY INDEX ROWID      | S_ORDER_TNTX      |     1 |    26 |       |     2   (0)| 00:00:01 |
    |* 42 |                        INDEX UNIQUE SCAN               | S_ORDER_TNTX_P1   |     1 |       |       |     1   (0)| 00:00:01 |
    |  43 |                      TABLE ACCESS BY INDEX ROWID       | S_DEPOSIT_TNT     |     1 |    45 |       |     1   (0)| 00:00:01 |
    |* 44 |                       INDEX UNIQUE SCAN                | S_DEPOSIT_TNT_P1  |     1 |       |       |     1   (0)| 00:00:01 |
    |  45 |                     TABLE ACCESS BY INDEX ROWID        | S_ORDER           |     1 |   101 |       |     2   (0)| 00:00:01 |
    |* 46 |                      INDEX UNIQUE SCAN                 | S_ORDER_P1        |     1 |       |       |     1   (0)| 00:00:01 |
    |  47 |                    TABLE ACCESS BY INDEX ROWID         | S_INVLOC          |     1 |    47 |       |     1   (0)| 00:00:01 |
    |* 48 |                     INDEX UNIQUE SCAN                  | S_INVLOC_P1       |     1 |       |       |     1   (0)| 00:00:01 |
    |  49 |                   TABLE ACCESS BY INDEX ROWID          | S_DOC_QUOTE       |     1 |    21 |       |     1   (0)| 00:00:01 |
    |* 50 |                    INDEX UNIQUE SCAN                   | S_DOC_QUOTE_P1    |     1 |       |       |     1   (0)| 00:00:01 |
    |* 51 |                  TABLE ACCESS FULL                     | S_ORG_EXT_TNTX    |     1 |    94 |       |     0   (0)| 00:00:01 |
    |  52 |                 TABLE ACCESS BY INDEX ROWID            | S_PTY_PAY_PRFL    |     1 |    74 |       |     1   (0)| 00:00:01 |
    |* 53 |                  INDEX UNIQUE SCAN                     | S_PTY_PAY_PRFL_P1 |     1 |       |       |     1   (0)| 00:00:01 |
    |  54 |                TABLE ACCESS BY INDEX ROWID             | S_ADDR_PER        |     1 |    84 |       |     2   (0)| 00:00:01 |
    |* 55 |                 INDEX UNIQUE SCAN                      | S_ADDR_PER_P1     |     1 |       |       |     1   (0)| 00:00:01 |
    |  56 |               TABLE ACCESS BY INDEX ROWID              | S_ADDR_PER        |     1 |    57 |       |     1   (0)| 00:00:01 |
    |* 57 |                INDEX UNIQUE SCAN                       | S_ADDR_PER_P1     |     1 |       |       |     1   (0)| 00:00:01 |
    |  58 |              TABLE ACCESS BY INDEX ROWID               | S_ORG_EXT         |     1 |    32 |       |     1   (0)| 00:00:01 |
    |* 59 |               INDEX UNIQUE SCAN                        | S_ORG_EXT_U3      |     1 |       |       |     1   (0)| 00:00:01 |
    |  60 |             TABLE ACCESS BY INDEX ROWID                | S_ORG_EXT         |     1 |    32 |       |     1   (0)| 00:00:01 |
    |* 61 |              INDEX UNIQUE SCAN                         | S_ORG_EXT_U3      |     1 |       |       |     1   (0)| 00:00:01 |
    |  62 |            TABLE ACCESS BY INDEX ROWID                 | S_ORG_EXT         |     1 |   256 |       |     2   (0)| 00:00:01 |
    |* 63 |             INDEX UNIQUE SCAN                          | S_ORG_EXT_U3      |     1 |       |       |     1   (0)| 00:00:01 |
    |  64 |           TABLE ACCESS BY INDEX ROWID                  | S_ACCNT_POSTN     |     1 |    32 |       |     3   (0)| 00:00:01 |
    |* 65 |            INDEX RANGE SCAN                            | S_ACCNT_POSTN_U1  |     1 |       |       |     2   (0)| 00:00:01 |
    |  66 |          TABLE ACCESS BY INDEX ROWID                   | S_POSTN           |     1 |    21 |       |     1   (0)| 00:00:01 |
    |* 67 |           INDEX UNIQUE SCAN                            | S_POSTN_U2        |     1 |       |       |     1   (0)| 00:00:01 |
    |  68 |         TABLE ACCESS BY INDEX ROWID                    | S_USER            |     1 |    25 |       |     2   (0)| 00:00:01 |
    |* 69 |          INDEX UNIQUE SCAN                             | S_USER_U2         |     1 |       |       |     1   (0)| 00:00:01 |
    |  70 |        TABLE ACCESS BY INDEX ROWID                     | S_ORG_EXT         |     1 |    32 |       |     2   (0)| 00:00:01 |
    |* 71 |         INDEX UNIQUE SCAN                              | S_ORG_EXT_U3      |     1 |       |       |     1   (0)| 00:00:01 |
    |  72 |       TABLE ACCESS BY INDEX ROWID                      | S_ASSET           |     1 |    24 |       |     2   (0)| 00:00:01 |
    |* 73 |        INDEX UNIQUE SCAN                               | S_ASSET_P1        |     1 |       |       |     2   (0)| 00:00:01 |
    |  74 |      TABLE ACCESS BY INDEX ROWID                       | S_CON_ADDR        |     1 |    36 |       |     3   (0)| 00:00:01 |
    |* 75 |       INDEX RANGE SCAN                                 | S_CON_ADDR_U1     |     1 |       |       |     2   (0)| 00:00:01 |
    |* 76 |     INDEX UNIQUE SCAN                                  | S_PARTY_P1        |     1 |    12 |       |     1   (0)| 00:00:01 |
    |  77 |    TABLE ACCESS BY INDEX ROWID                         | S_ORG_EXT_X       |     1 |    37 |       |     2   (0)| 00:00:01 |
    |* 78 |     INDEX RANGE SCAN                                   | S_ORG_EXT_X_U1    |     1 |       |       |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
      28 - filter("T27"."INVC_TYPE_CD"=:1)
      30 - access("T27"."PROJ_ID"="T8"."ROW_ID"(+))
      32 - access("T27"."PAYMENT_TERM_ID"="T23"."ROW_ID"(+))
      34 - access("T27"."ELEMENT_ID"="T26"."ROW_ID"(+))
      36 - access("T26"."INSCLM_ID"="T14"."ROW_ID"(+))
      38 - access("T27"."BL_PERIOD_ID"="T20"."ROW_ID"(+))
      40 - access("T27"."LAST_UPD_BY"="T15"."PAR_ROW_ID"(+))
      42 - access("T27"."ORDER_ID"="T18"."ROW_ID"(+))
      44 - access("T18"."PR_DEPOSIT_ID"="T21"."ROW_ID"(+))
      46 - access("T27"."ORDER_ID"="T4"."ROW_ID"(+))
      48 - access("T4"."SRC_INVLOC_ID"="T3"."ROW_ID"(+))
      50 - access("T4"."QUOTE_ID"="T12"."ROW_ID"(+))
      51 - filter("T12"."BU_ID"="T19"."PAR_ROW_ID"(+))
      53 - access("T27"."PER_PAY_PRFL_ID"="T2"."ROW_ID"(+))
      55 - access("T27"."BL_ADDR_ID"="T1"."ROW_ID"(+))
      57 - access("T27"."BL_ADDR_ID"="T22"."ROW_ID"(+))
      59 - access("T8"."BU_ID"="T5"."PAR_ROW_ID"(+))
      61 - access("T27"."REMIT_ORG_EXT_ID"="T16"."PAR_ROW_ID"(+))
      63 - access("T27"."ACCNT_ID"="T25"."PAR_ROW_ID"(+))
      65 - access("T25"."ROW_ID"="T13"."OU_EXT_ID"(+) AND "T25"."PR_POSTN_ID"="T13"."POSITION_ID"(+))
      67 - access("T13"."POSITION_ID"="T6"."PAR_ROW_ID"(+))
      69 - access("T6"."PR_EMP_ID"="T11"."PAR_ROW_ID"(+))
      71 - access("T25"."BU_ID"="T10"."PAR_ROW_ID"(+))
      73 - access("T3"."CG_ASSSET_ID"="T17"."ROW_ID"(+))
      75 - access("T27"."BL_ADDR_ID"="T9"."ADDR_PER_ID"(+) AND "T27"."ACCNT_ID"="T9"."ACCNT_ID"(+))
           filter("T27"."ACCNT_ID"="T9"."ACCNT_ID"(+))
      76 - access("T13"."POSITION_ID"="T7"."ROW_ID"(+))
      78 - access("T27"."ACCNT_ID"="T24"."PAR_ROW_ID"(+))
    117 rows selected.SQL> EXPLAIN PLAN FOR
    2 SELECT * FROM SIEBEL.S_INVOICE T27 WHERE T27.INVC_TYPE_CD=:1;
    Explained.
    SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
    PLAN_TABLE_OUTPUT
    Plan hash value: 1810797629
    | Id  | Operation         | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |           |    39M|     9G|  2016K  (8)| 00:53:59 |
    |*  1 |  TABLE ACCESS FULL| S_INVOICE |    39M|     9G|  2016K  (8)| 00:53:59 |
    Predicate Information (identified by operation id):
       1 - filter("T27"."INVC_TYPE_CD"=:1)
    13 rows selected.Edited by: KODS on Feb 13, 2013 1:08 PM

    Dear Ivan,
    Please find the details below.
    select * from dba_indexes where index_name = 'S_INVOICE_U1';
    OWNER                          INDEX_NAME                     INDEX_TYPE                  TABLE_OWNER                    TABLE_NAME                     TABLE_TYPE  UNIQUENESS COMPRESSION PREFIX_LENGTH TABLESPACE_NAME                INI_TRANS MAX_TRANS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE PCT_THRESHOLD INCLUDE_COLUMN FREELISTS FREELIST_GROUPS PCT_FREE LOGGING BLEVEL LEAF_BLOCKS DISTINCT_KEYS AVG_LEAF_BLOCKS_PER_KEY AVG_DATA_BLOCKS_PER_KEY CLUSTERING_FACTOR STATUS   NUM_ROWS SAMPLE_SIZE LAST_ANALYZED DEGREE                                   INSTANCES                                PARTITIONED TEMPORARY GENERATED SECONDARY BUFFER_POOL USER_STATS DURATION        PCT_DIRECT_ACCESS ITYP_OWNER                     ITYP_NAME                      PARAMETERS                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               GLOBAL_STATS DOMIDX_STATUS DOMIDX_OPSTATUS FUNCIDX_STATUS JOIN_INDEX IOT_REDUNDANT_PKEY_ELIM DROPPED
    SIEBEL                         S_INVOICE_U1                   NORMAL                      SIEBEL                         S_INVOICE                      TABLE       UNIQUE     DISABLED                  CRMSBL_AEM_INDEX                       2       255          65536                       1  2147483645                                                                           10 NO           3      902796     196739390                       1                       1         125598294 VALID    196739390   196739390 10-02-13      1                                        1                                        NO          N         N         N         DEFAULT     NO                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  YES                                                       NO         NO                      NO     
    select * from dba_ind_columns where index_name = 'S_INVOICE_U1' order by column_position;
    INDEX_OWNER                    INDEX_NAME                     TABLE_OWNER                    TABLE_NAME                     COLUMN_NAME                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      COLUMN_POSITION COLUMN_LENGTH CHAR_LENGTH DESCEND
    SIEBEL                         S_INVOICE_U1                   SIEBEL                         S_INVOICE                      INVC_NUM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       1           200          50 ASC    
    SIEBEL                         S_INVOICE_U1                   SIEBEL                         S_INVOICE                      INVC_TYPE_CD                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   2           120          30 ASC    
    SIEBEL                         S_INVOICE_U1                   SIEBEL                         S_INVOICE                      CONFLICT_ID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    3            60          15 ASC    

Maybe you are looking for

  • Run Multiple Instances of Windows Store App

    We have a desktop app which we are considering porting to Windows Store. Our app allows the user to generate orders. If the user wishes to generate several orders simultaneously, they open several instances of our app. Is it possible to run multiple

  • Calling a Report from Oracle Forms 10g

    Hi Everyone, I need assistance. Am running Oracle Forms & reports 10g. My Form module is running just fine. Inside the the Form Module I added a button with a "When Button Pressed Trigger" that has the following code declare      repid REPORT_OBJECT;

  • My dock connector no longer supplies an audio out

    My dock connector no longer supplies audio out when connecting it to a docking station. I am able to charge my I-pod just fine. The I-pod works on the docking stations but no sound comes out. I spoke with I-pod support and they suggested posting a qu

  • BREAKTHROUGH FOR WINDOWS VISTA DRIV

    right....i stumbled on this purely by chance so im not sure if it works with everyone's set up. Im running a SB Li've! soundcard, and have just installed Windows Vista Beta . Obviously there are no drivers out for this OS at present. I downloaded the

  • Bought more Ram!  This little guy is IMPRESSIVE!  Where can I sell old Ram?

    I just got 2 1GB Ram chips. Anyone know where I can sell my old 512x2 chips? Thanks If there's no splace that specializes in it, I guess I'll just do Craigslist or Ebay, but thought I'd ask on here first. But I have to say I am super impressed with t