Table's requirement for range partition?

Whether a table should have not null column for range partition.?
And, what are all the requirements for range partitioning.?
My table doesn't have primary key or not null column.

1 SELECT COUNT(TO_CHAR(dt_enc_negotiation_date,'YYYY')) "Entries",
2 TO_CHAR(dt_enc_negotiation_date,'YYYY') "Year"
3 FROM tbl_trn_exports
4 GROUP BY TO_CHAR(dt_enc_negotiation_date,'YYYY')
5* ORDER BY 2
15:11:27 SQL> /
Entries Year
1 1900
3 1902
2 1903
1 1983
5 1988
1 1989
6 1990
7 1992
5 1993
362 1994
1321 1995
20044 1996
44131 1997
1363994 1998
1222222 1999
1440499 2000
1611602 2001
1798035 2002
1886603 2003
2164553 2004
2230841 2005
2347830 2006
670443 2007
141 2008
1367 2009
2 2010
0
27 rows selected.
How many partitions can we choose for range partition?

Similar Messages

  • Table details required for pegged requirements

    Dear All,
    I have the following scenario.
    One child components is required for three different header materials. After MRP run, In MD04, three diffenerent planned orders will be there for child component for three reservations of three Header materials. I want to see the immediate header level of the child component through tables for report purpose. If you see through the function module MD_PEGGING or MD_PEGGING_NODIALOG, it is showing the top most header material. But it is not showing the immediate header material for the child component planned order. Please guide me to get the immediate header material through table or function module or any.
    Thanks in advance.
    Vijay.

    Check these tables.
    MDTB,PLAF.

  • What are the Master Table validations required for below fields

    Hi,
    I have created a selection screen with following fields.
    Can anybody tell me what are the exact master table vaidation i can do for the same!
    <b>Order Type[VBAK-AUART],
    Order Number[VBAK-VBELN],
    Customer PO #[VBKD-BSTKD],
    Sold-to Party No[VBPA-PARVW - SP as key],
    Ship-to Party No[VBPA-PARVW - SH as key],
    Division[VBAK-SPART].</b>
    Agaist which master tables i need to vaidate above fields!
    Also please clarify what is meant by [SP as Key] & [SH as key]! Is it needs to be defaulted!
    Thanks in advance.
    Thanks,
    Prasad.

    Hi Prasad,
    For your another Query
      SH- Ship To Party,
      SP - Sold To party.
    You can set anyone of them as Default depending on ur Bsuiness requirement ie. You are Forwarding ur Invoice to ship to or sold to Party.
    Regards,
    Leo

  • Urgent ...Table name Require for appraisal competency

    Hi All,
    can some one help me to sort out this issue.
    how can i know where the appraisal competency information is storing(i mean table names).
    i mean when appraiser enter the competency for his appraise.
    Thanks.
    Edited by: user627525 on Mar 17, 2009 4:35 AM

    Or try this query is you want a rating that gives u a number 0-5 for performance rating. I did this query a while ago. it also gives rating for the last 3-4 years. HR also wanted the rating rounded off. so i included that but i am sure u dont need it
    select distinct peo.person_id
    ,AK.AK_RATING "Final 2005/6"
    ,AK_DATE
    ,AC.AC_RATING "Final 2006/7"
    ,AC.AC_Date
    ,AF_Rating "Final 2007/8"
    ,AF_DATE
    ,nvl(to_char(AG.AG_Rating),'Not Yet Reviewed') "Current Rating 1st 6 mnths"
    ,nvl(to_char(AR.AR_RATING),'Not Yet Reviewed') "Current Rating 2nd 6 mnths"
    ,AG_DATE
    from hr.per_all_people_f peo,
    hr.per_all_assignments_f paa
    ,(SELECT DISTINCT peo.person_id AK_person_id
    ,pr.performance_rating AK_rating
    , pr.review_date AK_date
    FROM apps.per_performance_reviews pr,
    hr.per_all_people_f peo
    WHERE pr.person_id = peo.person_id
    and pr.review_date = (select pr1.review_date
    from apps.per_performance_reviews pr1
    where pr1.person_id = peo.person_id
    and pr1.review_date between '01-May-2006' and '31-Oct-2006' ) )AK
    ,(SELECT DISTINCT peo.person_id AP_person_id
    , case when pr.performance_rating <= 0.5 then '0'
    when pr.performance_rating > 0.5 and pr.performance_rating <= 1.5 then '1'
    when pr.performance_rating > 1.5 and pr.performance_rating <= 2.5 then '2'
    when pr.performance_rating > 2.5 and pr.performance_rating <= 3.5 then '3'
    when pr.performance_rating > 3.5 and pr.performance_rating <= 4.5 then '4'
    when pr.performance_rating > 4.5 and pr.performance_rating <= 5 then '5'
    when pr.performance_rating = 9 then '9'
    end ROUNDED_RATING
    ,pr.review_date AP_date
    FROM apps.per_performance_reviews pr,
    hr.per_all_people_f peo
    WHERE pr.person_id = peo.person_id
    and pr.review_date = (select pr1.review_date
    from apps.per_performance_reviews pr1
    where pr1.person_id = peo.person_id
    and pr1.review_date between '01-May-2006' and '31-Oct-2006' ) )AP
    ,(SELECT DISTINCT peo.person_id AC_person_id
    ,pr.performance_rating AC_rating
    , pr.review_date AC_date
    FROM apps.per_performance_reviews pr,
    hr.per_all_people_f peo
    WHERE pr.person_id = peo.person_id
    and pr.review_date = (select pr1.review_date
    from apps.per_performance_reviews pr1
    where pr1.person_id = peo.person_id
    and pr1.review_date between '01-May-2007' and '31-Oct-2007' ) )AC
    ,(SELECT DISTINCT peo.person_id AA_person_id
    , case when pr.performance_rating <= 0.5 then '0'
    when pr.performance_rating > 0.5 and pr.performance_rating <= 1.5 then '1'
    when pr.performance_rating > 1.5 and pr.performance_rating <= 2.5 then '2'
    when pr.performance_rating > 2.5 and pr.performance_rating <= 3.5 then '3'
    when pr.performance_rating > 3.5 and pr.performance_rating <= 4.5 then '4'
    when pr.performance_rating > 4.5 and pr.performance_rating <= 5 then '5'
    when pr.performance_rating = 9 then '9'
    end ROUNDED_RATING
    , pr.review_date AA_date
    FROM apps.per_performance_reviews pr,
    hr.per_all_people_f peo
    WHERE pr.person_id = peo.person_id
    and pr.review_date = (select pr1.review_date
    from apps.per_performance_reviews pr1
    where pr1.person_id = peo.person_id
    and pr1.review_date between '01-May-2007' and '31-Oct-2007' ) )AA
    ,(SELECT pr.person_id AF_Person_Id,
    pr.performance_rating AF_Rating,
    pr.review_date AF_Date
    FROM apps.per_performance_reviews pr,
    hr.per_all_people_f peo
    WHERE pr.person_id = peo.person_id
    and pr.REVIEW_DATE between '01-May-2008' and '31-Oct-2008' )AF
    ,(SELECT pr.person_id AB_Person_Id
    , case when pr.performance_rating <= 0.5 then '0'
    when pr.performance_rating > 0.5 and pr.performance_rating <= 1.5 then '1'
    when pr.performance_rating > 1.5 and pr.performance_rating <= 2.5 then '2'
    when pr.performance_rating > 2.5 and pr.performance_rating <= 3.5 then '3'
    when pr.performance_rating > 3.5 and pr.performance_rating <= 4.5 then '4'
    when pr.performance_rating > 4.5 and pr.performance_rating <= 5 then '5'
    when pr.performance_rating = 9 then '9'
    end ROUNDED_RATING
    ,pr.review_date AB_Date
    FROM apps.per_performance_reviews pr,
    hr.per_all_people_f peo
    WHERE pr.person_id = peo.person_id
    and pr.REVIEW_DATE between '01-May-2008' and '31-Oct-2008' )AB
    ,(SELECT pr.person_id AG_Person_Id,
    pr.performance_rating AG_Rating,
    pr.review_date AG_Date
    FROM apps.per_performance_reviews pr,
    hr.per_all_people_f peo
    WHERE pr.person_id = peo.person_id
    and pr.REVIEW_DATE between '01-Nov-2008' and '30-Apr-2009' )AG
    ,(SELECT pr.person_id AQ_Person_Id
    , case when pr.performance_rating <= 0.5 then '0'
    when pr.performance_rating > 0.5 and pr.performance_rating <= 1.5 then '1'
    when pr.performance_rating > 1.5 and pr.performance_rating <= 2.5 then '2'
    when pr.performance_rating > 2.5 and pr.performance_rating <= 3.5 then '3'
    when pr.performance_rating > 3.5 and pr.performance_rating <= 4.5 then '4'
    when pr.performance_rating > 4.5 and pr.performance_rating <= 5 then '5'
    when pr.performance_rating = 9 then '9'
    end ROUNDED_RATING
    ,pr.review_date AQ_Date
    FROM apps.per_performance_reviews pr,
    hr.per_all_people_f peo
    WHERE pr.person_id = peo.person_id
    and pr.REVIEW_DATE between '01-Nov-2008' and '30-Apr-2009' )AQ
    ,(SELECT pr.person_id AR_Person_Id,
    nvl(pr.performance_rating,0) AR_Rating,
    pr.review_date AR_Date
    FROM apps.per_performance_reviews pr,
    hr.per_all_people_f peo
    WHERE pr.person_id = peo.person_id
    and pr.REVIEW_DATE between '01-May-2009' and '31-Oct-2009' )AR
    ,(SELECT pr.person_id AU_Person_Id
    , case when pr.performance_rating <= 0.5 then '0'
    when pr.performance_rating > 0.5 and pr.performance_rating <= 1.5 then '1'
    when pr.performance_rating > 1.5 and pr.performance_rating <= 2.5 then '2'
    when pr.performance_rating > 2.5 and pr.performance_rating <= 3.5 then '3'
    when pr.performance_rating > 3.5 and pr.performance_rating <= 4.5 then '4'
    when pr.performance_rating > 4.5 and pr.performance_rating <= 5 then '5'
    when pr.performance_rating = 9 then '9'
    end ROUNDED_RATING
    ,pr.review_date AU_Date
    FROM apps.per_performance_reviews pr,
    hr.per_all_people_f peo
    WHERE pr.person_id = peo.person_id
    and pr.REVIEW_DATE between '01-May-2009' and '31-Oct-2009' )AU
    where peo.person_id = paa.person_id
    and trunc(sysdate) between peo.effective_start_date and peo.effective_end_date
    and trunc(sysdate) between paa.effective_start_date and paa.effective_end_date
    AND peo.CURRENT_EMPLOYEE_FLAG = 'Y'
    AND paa.PRIMARY_FLAG = 'Y'
    AND paa.ORGANIZATION_ID != 1301
    AND peo.EMPLOYEE_NUMBER != '0000001'
    AND peo.BUSINESS_GROUP_ID = '82'
    and AC.AC_person_id(+) = peo.person_id
    AND AF.AF_PERSON_ID(+) = PEO.PERSON_ID
    and AG.AG_PERSON_ID(+) = PEO.PERSON_ID
    and AK.AK_PERSON_ID(+) = peo.person_id
    AND AA.AA_PERSON_ID(+) = PEO.PERSON_ID
    AND AB.AB_PERSON_ID(+) = PEO.PERSON_ID
    and AP.AP_PERSON_ID(+) = PEO.PERSON_ID
    and AR.AR_PERSON_ID(+) = PEO.PERSON_ID
    and AQ.AQ_PERSON_ID(+) = PEO.PERSON_ID
    and AU.AU_PERSON_ID(+) = PEO.PERSON_ID
    order by peo.person_id -- , pr.review_date desc

  • Table names required for workflow definition

    Hi All,
    I need to know which tables stores all the task level information for a given workflow.
    Also alongwith the above query need to know which table stores information of exception and parameter for BOR methods.
    Thanks in advance,
    Imran

    Hi Imran,
    If I understand your query... you need a table that stores information of the workitems.
    See if the table SWWWIHEAD (Header Table for all Work Item Types) helps you.
    Hope this helps!
    Regards,
    Saumya

  • Partition Pruning on Interval Range Partitioned Table not happening when SYSDATE used in Where Clause

    We have tables that are interval range partitioned on a DATE column, with a partition for each day - all very standard and straight out of Oracle doc.
    A 3rd party application queries the tables to find number of rows based on date range that is on the column used for the partition key.
    This application uses date range specified relative to current date - i.e. for last two days would be "..startdate > SYSDATE -2 " - but partition pruning does not take place and the explain plan shows that every partition is included.
    By presenting the query using the date in a variable partition pruning does table place, and query obviously performs much better.
    DB is 11.2.0.3 on RHEL6, and default parameters set - i.e. nothing changed that would influence optimizer behavior to something unusual.
    I can't work out why this would be so. It very easy to reproduce with simple test case below.
    I'd be very interested to hear any thoughts on why it is this way and whether anything can be done to permit the partition pruning to work with a query including SYSDATE as it would be difficult to get the application code changed.
    Furthermore to make a case to change the code I would need an explanation of why querying using SYSDATE is not good practice, and I don't know of any such information.
    1) Create simple partitioned table
    CREATETABLE part_test
       (id                      NUMBER NOT NULL,
        starttime               DATE NOT NULL,
        CONSTRAINT pk_part_test PRIMARY KEY (id))
    PARTITION BY RANGE (starttime) INTERVAL (NUMTODSINTERVAL(1,'day')) (PARTITION p0 VALUES LESS THAN (TO_DATE('01-01-2013','DD-MM-YYYY')));
    2) Populate table 1million rows spread between 10 partitions
    BEGIN
        FOR i IN 1..1000000
        LOOP
            INSERT INTO part_test (id, starttime) VALUES (i, SYSDATE - DBMS_RANDOM.value(low => 1, high => 10));
        END LOOP;
    END;
    EXEC dbms_stats.gather_table_stats('SUPER_CONF','PART_TEST');
    3) Query the Table for data from last 2 days using SYSDATE in clause
    EXPLAIN PLAN FOR
    SELECT  count(*)
    FROM    part_test
    WHERE   starttime >= SYSDATE - 2;
    | Id  | Operation                 | Name      | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    |   0 | SELECT STATEMENT          |           |     1 |     8 |  7895  (1)| 00:00:01 |       |       |
    |   1 |  SORT AGGREGATE           |           |     1 |     8 |            |          |       |       |
    |   2 |   PARTITION RANGE ITERATOR|           |   111K|   867K|  7895   (1)| 00:00:01 |   KEY |1048575|
    |*  3 |    TABLE ACCESS FULL      | PART_TEST |   111K|   867K|  7895   (1)| 00:00:01 |   KEY |1048575|
    Predicate Information (identified by operation id):
       3 - filter("STARTTIME">=SYSDATE@!-2)
    4) Now do the same query but with SYSDATE - 2 presented as a literal value.
    This query returns the same answer but very different cost.
    EXPLAIN PLAN FOR
    SELECT count(*)
    FROM part_test
    WHERE starttime >= (to_date('23122013:0950','DDMMYYYY:HH24MI'))-2;
    | Id  | Operation                 | Name      | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    |   0 | SELECT STATEMENT          |           |     1 |     8 |   131  (0)| 00:00:01 |       |       |
    |   1 |  SORT AGGREGATE           |           |     1 |     8 |            |          |       |       |
    |   2 |   PARTITION RANGE ITERATOR|           |   111K|   867K|   131   (0)| 00:00:01 |   356 |1048575|
    |*  3 |    TABLE ACCESS FULL      | PART_TEST |   111K|   867K|   131   (0)| 00:00:01 |   356 |1048575|
    Predicate Information (identified by operation id):
       3 - filter("STARTTIME">=TO_DATE(' 2013-12-21 09:50:00', 'syyyy-mm-dd hh24:mi:ss'))
    thanks in anticipation
    Jim

    As Jonathan has already pointed out there are situations where the CBO knows that partition pruning will occur but is unable to identify those partitions at parse time. The CBO will then use a dynamic pruning which means determine the partitions to eliminate dynamically at run time. This is why you see the KEY information instead of a known partition number. This is to occur mainly when you compare a function to your partition key i.e. where partition_key = function. And SYSDATE is a function. For the other bizarre PSTOP number (1048575) see this blog
    http://hourim.wordpress.com/2013/11/08/interval-partitioning-and-pstop-in-execution-plan/
    Best regards
    Mohamed Houri

  • Determine partition range start and stop for a partition

    Hi,
    Using oracle 11.2.0.3
    We are using range interval partitioning and partition sget generated automatically. (range-hash) intervbal 1 month
    Whilst can check table manually and see start and end range of partition is it possible to query data dictionary to see
    the satrt and stop range as wish to have script to automatically rename the system generated partitions based on the range involved e.g if generated partition has max date value
    3062013 waoul want PART_201306
    Thanks

    Thanks for replies.
    Have triied following sql but despite partition keyword in from clause is not using partition pruning.
    Table belwo retailer_transaction date-range partitioned 1 per month.
    If have to explictly use partitiong_date as condition in where clause to get partition pruning.
    Need to ab able to determine what start and stop dates for that month is automatically.
    Checked user_tab_partitions as have sql geneerator can get partition names but doesn't show partition start an dstop ranges.
    How can I achieve this
    sql gneerator starts
      for p in
       ( select U.PARTITION_NAME
         from ALL_tab_partitions u
         where u.table_name = 'RETAILER_TRANSACTION'
         and u.partition_name = 'PART_201001'
       loop
           v_sql := q'[create table rt_sum_]'||p.partition_name||q'[ parallel nologging
    as
    SELECT
    MAX(rt.outlet_id) KEEP (DENSE_RANK FIRST ORDER BY  c.day_dte) as outlet_id,
    MAX(rt.plant_issue_id) KEEP (DENSE_RANK FIRST ORDER BY  c.day_dte) as plant_issue_id,
    MAX(rt.cus_plant_id) KEEP (DENSE_RANK FIRST ORDER BY  c.day_dte) as cus_plant_id,
    MAX(rt.distributor_id) KEEP (DENSE_RANK FIRST ORDER BY  c.day_dte) as distributor_id,
    MAX(rt.publisher_id) KEEP (DENSE_RANK FIRST ORDER BY  c.day_dte) as publisher_id,
    MAX(rt.sas_id) KEEP (DENSE_RANK FIRST ORDER BY  c.day_dte) as sas_id,
    MAX(rt.product_band_id) KEEP (DENSE_RANK FIRST ORDER BY  c.day_dte) as product_band_id,
    MAX(r.mult_id) KEEP (DENSE_RANK FIRST ORDER BY  c.day_dte) as mult_id,
          r.out_num,
           m.plis_issue_num,
           min(rt.currency_id) currency_id, -- to fix cutover prob if mix £ and E then forces to E
           max(rt.currency_convertor_id) currency_convertor_id,
           sum(case when rtrt.TYP_MAIN_SUPPLY_FLAG = 1 then rt.TRANSACTION_QUANTITY ELSE 0 end) main_supply,
           sum(case when rtrt.TYP_COPIES_INVOICED_FLAG = 1 then rt.TRANSACTION_QUANTITY ELSE 0 end) -
           sum(case when rtrt.TYP_MAIN_SUPPLY_FLAG = 1 then rt.TRANSACTION_QUANTITY ELSE 0 end) extra_supply,
           sum(case when rtrt.TYP_COPIES_INVOICED_FLAG = 1 then rt.TRANSACTION_QUANTITY ELSE 0 end) SALES,
           sum(case when rtrt.TYP_RETURN_FLAG = 1 then rt.TRANSACTION_QUANTITY ELSE 0 end) RETURNS,
           sum(case when rtrt.TYP_CREDIT_FLAG = 1 then rt.TRANSACTION_QUANTITY ELSE 0 end) CREDITS,
           sum(case when rtrt.TYP_RETURN_FLAG = 1 AND c.day_dte < m.plis_recall_date then rt.TRANSACTION_QUANTITY ELSE 0 end) early_returns,
           sum(case when rtrt.TYP_CRD_MANAGER_CREDIT_FLAG = 1 then rt.TRANSACTION_QUANTITY ELSE 0 end) managers_credit_qty, -- TO CHECK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
          decode(sign(sum(case when rtrt.TYP_CREDIT_FLAG = 1 then rt.TRANSACTION_QUANTITY ELSE 0 end)),1,null,( case when sysdate < max(m.plis_claim_end_date) then 'P' ELSE 'Y' end )) sellout_type, -- null= not soldout, 'P'= potential sellout, 'Y'=Sellout (flag based on claim end date)
    -- retail
    sum(case when rtrt.TYP_COPIES_INVOICED_FLAG = 1 then rt.retail_value_excl_vat ELSE 0 end) retail_inv_val_excl_vat,
    sum(case when rtrt.TYP_COPIES_INVOICED_FLAG = 1 then rt.retail_value_vat ELSE 0 end)  retail_inv_val_vat,
    sum(case when rtrt.TYP_RETURN_FLAG = 1 then rt.retail_value_excl_vat ELSE 0 end)  retail_ret_val_excl_vat,
    sum(case when rtrt.TYP_RETURN_FLAG = 1 then rt.retail_value_vat ELSE 0 end)  retail_ret_val_vat,
    sum(case when rtrt.TYP_CREDIT_FLAG = 1 then rt.retail_value_excl_vat ELSE 0 end)  retail_crd_val_excl_vat,
    sum(case when rtrt.TYP_CREDIT_FLAG = 1 then rt.retail_value_vat ELSE 0 end)  retail_crd_val_vat,
    -- trade
    sum(case when rtrt.TYP_COPIES_INVOICED_FLAG = 1 then rt.trade_value_excl_vat ELSE 0 end)  trade_inv_val_excl_vat,
    sum(case when rtrt.TYP_COPIES_INVOICED_FLAG = 1 then rt.trade_value_vat ELSE 0 end)  trade_inv_val_vat,
    sum(case when rtrt.TYP_RETURN_FLAG = 1 then rt.trade_value_excl_vat ELSE 0 end)  trade_ret_val_excl_vat,
    sum(case when rtrt.TYP_RETURN_FLAG = 1 then rt.trade_value_vat ELSE 0 end)  trade_ret_val_vat,
    sum(case when rtrt.TYP_CREDIT_FLAG = 1 then rt.trade_value_excl_vat ELSE 0 end)  trade_crd_val_excl_vat,
    sum(case when rtrt.TYP_CREDIT_FLAG = 1 then rt.trade_value_vat ELSE 0 end)  trade_crd_val_vat,
    -- cost
    sum(case when rtrt.TYP_COPIES_INVOICED_FLAG = 1 then rt.cost_value_excl_vat ELSE 0 end)  cost_inv_val_excl_vat,
    sum(case when rtrt.TYP_COPIES_INVOICED_FLAG = 1 then rt.cost_value_vat ELSE 0 end)  cost_inv_val_vat,
    sum(case when rtrt.TYP_RETURN_FLAG = 1 then rt.cost_value_excl_vat ELSE 0 end)  cost_ret_val_excl_vat,
    sum(case when rtrt.TYP_RETURN_FLAG = 1 then rt.cost_value_vat ELSE 0 end)  cost_ret_val_vat,
    sum(case when rtrt.TYP_CREDIT_FLAG = 1 then rt.cost_value_excl_vat ELSE 0 end)  cost_crd_val_excl_vat,
    sum(case when rtrt.TYP_CREDIT_FLAG = 1 then rt.cost_value_vat ELSE 0 end)  cost_crd_val_vat,
         min(case when rtrt.TYP_COPIES_INVOICED_FLAG = 1 then rt.day_id ELSE null end) first_supply_day_id,
         max(case when rtrt.TYP_COPIES_INVOICED_FLAG = 1 then rt.day_id ELSE null end) last_supply_day_id,
         min(case when rtrt.TYP_RETURN_FLAG = 1 then rt.day_id ELSE null end) first_return_day_id,
         max(case when rtrt.TYP_RETURN_FLAG = 1 then rt.day_id ELSE null end) last_return_day_id
    FROM
      dw.MEDIA m,
      dw.RETAILER_TRN_REPORT_TYPE rtrt,
      dw.RETAILER_TRANSACTION partition (]'||p.partition_name||q'[) rt,
      dw.RETAILER r,
    --  dw.WHOLESALER w,
      dw.CALENDAR  c
    WHERE
    --rt.CUS_PLANT_ID=w.DIMENSION_KEY 
    --AND
      rt.OUTLET_ID=r.DIMENSION_KEY 
    AND  rt.PLANT_ISSUE_ID = m.DIMENSION_KEY 
    AND   rtrt.DIMENSION_KEY=rt.REPORTING_TRN_TYPE_ID 
    AND  rt.DAY_ID=c.DIMENSION_KEY 
    --and rt.partitioning_date = m.plis_partitioning_date
    -- and m.PLIS_HANDLED_YEAR = 2013--> 2011
    group by
      r.out_num,
      m.plis_issue_num]';
    EXECUTE IMMEDIATE(V_SQL);
    INSERT INTO RTRN_PART_SUM_AUDIT
    (PARTITION_NAME, DATE_CREATED)
    VALUES(P.PARTITION_NAME, SYSDATE);
    COMMIT;  
       end loop;
      

  • Requirements for swap partiion

    Hi Gurus,
    You guys are rocking!!!
    I need an urgent reply since we are having a discussion on partitioning the tables.
    I have 2 schemas , PROCESSING and REPORTING.
    REPORTING schema has 3 year worth of rolling data. PROCESSING will have just the current month data. I have some 40 tables in REPORTING schema which I am planning to partition based on Months and Region as follows
    CREATE TABLE regional_sales
                ( deptno number, item_no varchar2(20),
                  txn_date date, txn_amount number, state varchar2(2))
       PARTITION BY RANGE (txn_date)
       SUBPARTITION BY LIST (state)
       SUBPARTITION TEMPLATE
          (SUBPARTITION west VALUES ('W') TABLESPACE tbs_1,
           SUBPARTITION east VALUES ('E') TABLESPACE tbs_1,
           SUBPARTITION north VALUES ('N') TABLESPACE tbs_1      
      (PARTITION p1 VALUES LESS THAN ( trunc(TO_DATE('01-Feb-2007','DD-MON-YYYY'),'MM'))),
       PARTITION p2 VALUES LESS THAN ( trunc(TO_DATE('01-Mar-2007','DD-MON-YYYY'),'MM'))),
       PARTITION p1 VALUES LESS THAN ( trunc(TO_DATE('01-sep-2008','DD-MON-YYYY'),'MM')))
    [/code]
    Now every day in PROCESSING schema, data gets inserted for the current month say september 2008. My requirement is I need to copy data from PROCESSING for this current month to the REPORT SCHEMA daily... Basically its like delete current months data in REPORT schema and copy the computed values for the current month from PROCESSING schema . This should happen daily night.
    Is there a way of doing this easily?
    -> One of my friends told to try SWAP partition. Can I implement SWAP partitions here in this scenario? I need the latest computed records for current month in PROCESSING schema, keep it and also copy it to REPORTING schema...meaning after copying both the schemas will have latest values for current month.
    -> what are the requirements for swap partition?
    -> Or is there an elegant way of copying ?
    Thanks guys.
    Saff                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Then I take my first posting back. Partition (subpartition to be precise) exchange is the best solution:
    SQL> CREATE TABLE regional_sales(
      2                              deptno number,
      3                              item_no varchar2(20),
      4                              txn_date date,
      5                              txn_amount number,
      6                              state varchar2(2)
      7                             )
      8    PARTITION BY RANGE (txn_date)
      9      SUBPARTITION BY LIST (state)
    10        SUBPARTITION TEMPLATE(
    11                              SUBPARTITION west VALUES ('W') TABLESPACE users,
    12                              SUBPARTITION east VALUES ('E') TABLESPACE users,
    13                              SUBPARTITION north VALUES ('N') TABLESPACE users
    14                             )
    15    (
    16     PARTITION p1 VALUES LESS THAN (TO_DATE('01-Aug-2008','DD-MON-YYYY')),
    17     PARTITION p2 VALUES LESS THAN (TO_DATE('01-Sep-2008','DD-MON-YYYY')),
    18     PARTITION p3 VALUES LESS THAN (TO_DATE('01-Oct-2008','DD-MON-YYYY'))
    19    )
    20  /
    Table created.
    SQL> CREATE TABLE regional_sales_processing(
      2                                         deptno number,
      3                                         item_no varchar2(20),
      4                                         txn_date date,
      5                                         txn_amount number,
      6                                         state varchar2(2)
      7                                        )
      8    PARTITION BY LIST (state)
      9    (
    10     PARTITION west VALUES ('W') TABLESPACE example,
    11     PARTITION east VALUES ('E') TABLESPACE example,
    12     PARTITION north VALUES ('N') TABLESPACE example
    13    )
    14  /
    Table created.
    SQL> CREATE TABLE regional_sales_processing_reg(
      2                                             deptno number,
      3                                             item_no varchar2(20),
      4                                             txn_date date,
      5                                             txn_amount number,
      6                                             state varchar2(2)
      7                                            )
      8    TABLESPACE example
      9  /
    Table created.
    SQL>
    SQL> -- Daily Processing Day 1
    SQL>
    SQL> TRUNCATE TABLE regional_sales_processing
      2  /
    Table truncated.
    SQL> INSERT
      2    INTO regional_sales_processing
      3    VALUES(
      4           1,
      5           1,
      6           sysdate-1,
      7           100,
      8           'E'
      9          )
    10  /
    1 row created.
    SQL> INSERT
      2    INTO regional_sales_processing
      3    VALUES(
      4           1,
      5           1,
      6           sysdate-1,
      7           100,
      8           'W'
      9          )
    10  /
    1 row created.
    SQL> INSERT
      2    INTO regional_sales_processing
      3    VALUES(
      4           1,
      5           1,
      6           sysdate-1,
      7           100,
      8           'N'
      9          )
    10  /
    1 row created.
    SQL> COMMIT
      2  /
    Commit complete.
    SQL> SELECT  *
      2    FROM regional_sales
      3  /
    no rows selected
    SQL> TRUNCATE TABLE regional_sales_processing_reg
      2  /
    Table truncated.
    SQL> INSERT
      2    INTO regional_sales_processing_reg
      3    SELECT  *
      4      FROM  regional_sales_processing
      5      WHERE state = 'E'
      6  /
    1 row created.
    SQL> ALTER TABLE regional_sales
      2    EXCHANGE SUBPARTITION p3_east
      3      WITH TABLE regional_sales_processing_reg
      4  /
    Table altered.
    SQL> TRUNCATE TABLE regional_sales_processing_reg
      2  /
    Table truncated.
    SQL> INSERT
      2    INTO regional_sales_processing_reg
      3    SELECT  *
      4      FROM  regional_sales_processing
      5      WHERE state = 'W'
      6  /
    1 row created.
    SQL> ALTER TABLE regional_sales
      2    EXCHANGE SUBPARTITION p3_west
      3      WITH TABLE regional_sales_processing_reg
      4  /
    Table altered.
    SQL> TRUNCATE TABLE regional_sales_processing_reg
      2  /
    Table truncated.
    SQL> INSERT
      2    INTO regional_sales_processing_reg
      3    SELECT  *
      4      FROM  regional_sales_processing
      5      WHERE state = 'N'
      6  /
    1 row created.
    SQL> ALTER TABLE regional_sales
      2    EXCHANGE SUBPARTITION p3_north
      3      WITH TABLE regional_sales_processing_reg
      4  /
    Table altered.
    SQL> SELECT  *
      2    FROM regional_sales
      3  /
        DEPTNO ITEM_NO              TXN_DATE  TXN_AMOUNT ST
             1 1                    10-SEP-08        100 W
             1 1                    10-SEP-08        100 E
             1 1                    10-SEP-08        100 N
    SQL>
    SQL>
    SQL> -- Daily Processing Day 2
    SQL>
    SQL> TRUNCATE TABLE regional_sales_processing
      2  /
    Table truncated.
    SQL> INSERT
      2    INTO regional_sales_processing
      3    VALUES(
      4           1,
      5           1,
      6           sysdate-1,
      7           100,
      8           'E'
      9          )
    10  /
    1 row created.
    SQL> INSERT
      2    INTO regional_sales_processing
      3    VALUES(
      4           1,
      5           1,
      6           sysdate-1,
      7           100,
      8           'W'
      9          )
    10  /
    1 row created.
    SQL> INSERT
      2    INTO regional_sales_processing
      3    VALUES(
      4           1,
      5           1,
      6           sysdate-1,
      7           100,
      8           'N'
      9          )
    10  /
    1 row created.
    SQL> INSERT
      2    INTO regional_sales_processing
      3    VALUES(
      4           2,
      5           2,
      6           sysdate,
      7           200,
      8           'E'
      9          )
    10  /
    1 row created.
    SQL> INSERT
      2    INTO regional_sales_processing
      3    VALUES(
      4           2,
      5           2,
      6           sysdate,
      7           200,
      8           'W'
      9          )
    10  /
    1 row created.
    SQL> INSERT
      2    INTO regional_sales_processing
      3    VALUES(
      4           2,
      5           2,
      6           sysdate,
      7           200,
      8           'N'
      9          )
    10  /
    1 row created.
    SQL> COMMIT
      2  /
    Commit complete.
    SQL> SELECT  *
      2    FROM regional_sales
      3  /
        DEPTNO ITEM_NO              TXN_DATE  TXN_AMOUNT ST
             1 1                    10-SEP-08        100 W
             1 1                    10-SEP-08        100 E
             1 1                    10-SEP-08        100 N
    SQL> TRUNCATE TABLE regional_sales_processing_reg
      2  /
    Table truncated.
    SQL> INSERT
      2    INTO regional_sales_processing_reg
      3    SELECT  *
      4      FROM  regional_sales_processing
      5      WHERE state = 'E'
      6  /
    2 rows created.
    SQL> ALTER TABLE regional_sales
      2    EXCHANGE SUBPARTITION p3_east
      3      WITH TABLE regional_sales_processing_reg
      4      WITH VALIDATION
      5  /
    Table altered.
    SQL> TRUNCATE TABLE regional_sales_processing_reg
      2  /
    Table truncated.
    SQL> INSERT
      2    INTO regional_sales_processing_reg
      3    SELECT  *
      4      FROM  regional_sales_processing
      5      WHERE state = 'W'
      6  /
    2 rows created.
    SQL> ALTER TABLE regional_sales
      2    EXCHANGE SUBPARTITION p3_west
      3      WITH TABLE regional_sales_processing_reg
      4      WITH VALIDATION
      5  /
    Table altered.
    SQL> TRUNCATE TABLE regional_sales_processing_reg
      2  /
    Table truncated.
    SQL> INSERT
      2    INTO regional_sales_processing_reg
      3    SELECT  *
      4      FROM  regional_sales_processing
      5      WHERE state = 'N'
      6  /
    2 rows created.
    SQL> ALTER TABLE regional_sales
      2    EXCHANGE SUBPARTITION p3_north
      3      WITH TABLE regional_sales_processing_reg
      4      WITH VALIDATION
      5  /
    Table altered.
    SQL> SELECT  *
      2    FROM regional_sales
      3  /
        DEPTNO ITEM_NO              TXN_DATE  TXN_AMOUNT ST
             1 1                    10-SEP-08        100 W
             2 2                    11-SEP-08        200 W
             1 1                    10-SEP-08        100 E
             2 2                    11-SEP-08        200 E
             1 1                    10-SEP-08        100 N
             2 2                    11-SEP-08        200 N
    6 rows selected.
    SQL> Now, if in your case there will be local indexes involved you will need to add INCLUDING INDEXES caluse to exchange statements. Any global indexes will become unusable and you will have to rebuild them.
    SY.

  • Materialized View Log - Compress Clause for List Partition

    Hi All,
    In Syntax diagram it states that Compress Clause for List Partition of Materialized View Log is valid , but when we run any script with compress clause for list partition on Materialized view log then Database throws error as ORA-14020: this physical attribute may not be specified for a table partition
    So in any chance we can have the compress clause for the partition of materialized view log.
    Thanks in advance,
    Manu.

    The "CREATE MATERIALIZED VIEW LOG" syntax refers to the "Table Partitioning" section of the CREATE TABLE documentation.
    The "Table Partitioning" section refers to "table_partition_description" which then refers to "table_compression". "table_compression" then states that you can specify compression for entire table in the physical_properties clause and for range partition / list partition in the "table_partition_description". The Restrictions section on Table Compression says "You cannot define table compression explicitly for hash partitions or hash and list subpartitions" which implies that you can define partition for list partitions.
    Moreover, error 14020 lists valid options for Range or Composite Range and for Hash partitoins -- which implies that all other Table physical attributes are applicable for List partitions. (But then, is Compression a physical attribute -- it is really part of "physical properties" not "physical attributes").
    I think that the documentation isn't explicit enough and needs to be fixed.
    N.B : Referencing the 10.2 documentation.
    Hemant K Chitale
    Edited by: Hemant K Chitale on Feb 1, 2010 4:12 PM

  • Regarding Range Partition

    Hi,
    Is it possible to add a partition which will only contain NULL values for RANGE PARTITIONING.
    Actually I cann't add a partition like "VALUES LESS THAN (MAXVALUE)"
    as dynamically we will drop and add partition in this table and if I add a partition like "VALUES LESS THAN (MAXVALUE)" then we cann't add a partition, as it will gives an error "ORA-14074: partition bound must collate higher than that of the last partition". Is there any way of adding only NULL partition for range partition.
    Thanks in advance,
    Koushik

    Hi,
    Yes, you won't be able to add a new partition.. but did you think about SPLIT partition instead of ADD ?
    Regards,
    Yoann.

  • Doubt on Range Partitions

    Hello everyone.
    Oracle9i Enterprise Edition Release 9.2.0.5.0 - 64bit Production
    18:44:45 161:tcs237427@EBPP> desc rs_ebpp.rs_mail_job
    Name Null? Type
    JOB_KEY NOT NULL VARCHAR2(50)
    MOF_KEY NOT NULL VARCHAR2(50)
    MOF_PATH VARCHAR2(255)
    REPORT_ID NOT NULL NUMBER(38)
    PROFILE_NAME VARCHAR2(25)
    FILE_PATH VARCHAR2(1024)
    JOB_DATE DATE
    JOB_FINISH_DATE DATE
    SCHEDULED NUMBER(38)
    USER_ID VARCHAR2(25)
    STATUS VARCHAR2(25)
    COMMENTS VARCHAR2(255)
    MAIL_FROM VARCHAR2(255)
    MAIL_TO VARCHAR2(255)
    MAIL_CC VARCHAR2(255)
    MAIL_BCC VARCHAR2(255)
    MAIL_SUBJECT VARCHAR2(255)
    MAIL_MESSAGE VARCHAR2(512)
    DATA7 VARCHAR2(50)
    DATA8 VARCHAR2(50)
    DATA9 VARCHAR2(50)
    DATA20 DATE
    DATA21 NUMBER
    DATA22 NUMBER
    DATA23 NUMBER
    DATA24 NUMBER
    DATA25 NUMBER
    DATA26 FLOAT(126)
    DATA27 FLOAT(126)
    DATA28 FLOAT(126)
    DATA29 FLOAT(126)
    DATA30 FLOAT(126)
    DATA10 VARCHAR2(50)
    DATA11 VARCHAR2(50)
    DATA12 VARCHAR2(50)
    DATA13 VARCHAR2(50)
    DATA14 VARCHAR2(50)
    DATA1 VARCHAR2(50)
    DATA15 VARCHAR2(50)
    DATA16 DATE
    DATA2 VARCHAR2(50)
    DATA17 DATE
    DATA3 VARCHAR2(50)
    DATA4 VARCHAR2(50)
    DATA18 DATE
    DATA5 VARCHAR2(50)
    DATA19 DATE
    DATA6 VARCHAR2(50)
    I tried to create range partition on table whose partitioning key (JOB_KEY) was a VARCHAR2. I was able to create the partitions till 30th Jan.
    16:56:32 SQL> SELECT PARTITION_NAME,TABLE_NAME,HIGH_VALUE FROM DBA_TAB_PARTITIONS WHERE TABLE_NAME='RS_MAIL_JOB_NEW' ORDER BY 1;
    Partition
    Name TABLE_NAME HIGH_VALUE
    P110101 RS_MAIL_JOB_NEW TO_DATE('2011-01-02 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110102 RS_MAIL_JOB_NEW TO_DATE('2011-01-03 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110103 RS_MAIL_JOB_NEW TO_DATE('2011-01-04 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110104 RS_MAIL_JOB_NEW TO_DATE('2011-01-05 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110105 RS_MAIL_JOB_NEW TO_DATE('2011-01-06 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110106 RS_MAIL_JOB_NEW TO_DATE('2011-01-07 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110107 RS_MAIL_JOB_NEW TO_DATE('2011-01-08 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110108 RS_MAIL_JOB_NEW TO_DATE('2011-01-09 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110109 RS_MAIL_JOB_NEW TO_DATE('2011-01-10 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110110 RS_MAIL_JOB_NEW TO_DATE('2011-01-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110111 RS_MAIL_JOB_NEW TO_DATE('2011-01-12 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110112 RS_MAIL_JOB_NEW TO_DATE('2011-01-13 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110113 RS_MAIL_JOB_NEW TO_DATE('2011-01-14 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110114 RS_MAIL_JOB_NEW TO_DATE('2011-01-15 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110115 RS_MAIL_JOB_NEW TO_DATE('2011-01-16 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110116 RS_MAIL_JOB_NEW TO_DATE('2011-01-17 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110117 RS_MAIL_JOB_NEW TO_DATE('2011-01-18 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110118 RS_MAIL_JOB_NEW TO_DATE('2011-01-19 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110119 RS_MAIL_JOB_NEW TO_DATE('2011-01-20 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110120 RS_MAIL_JOB_NEW TO_DATE('2011-01-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110121 RS_MAIL_JOB_NEW TO_DATE('2011-01-22 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110122 RS_MAIL_JOB_NEW TO_DATE('2011-01-23 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110123 RS_MAIL_JOB_NEW TO_DATE('2011-01-24 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110124 RS_MAIL_JOB_NEW TO_DATE('2011-01-25 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110125 RS_MAIL_JOB_NEW TO_DATE('2011-01-26 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110126 RS_MAIL_JOB_NEW TO_DATE('2011-01-27 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110127 RS_MAIL_JOB_NEW TO_DATE('2011-01-28 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110128 RS_MAIL_JOB_NEW TO_DATE('2011-01-29 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110129 RS_MAIL_JOB_NEW TO_DATE('2011-01-30 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    P110130 RS_MAIL_JOB_NEW TO_DATE('2011-01-31 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN
    But after that I started getting below error:
    16:56:40 SQL> alter table rs_ebpp.rs_mail_job_new add partition p110131 values less than (to_date('2011-02-01 00:00:00', 'SYYYY-mm-dd h
    h24:mi:ss', 'nls_calendar=GREGORIAN'));
    alter table rs_ebpp.rs_mail_job_new add partition p110131 values less than (to_date('2011-02-01 00:00:00', 'SYYYY-mm-dd hh24:mi:ss', 'n
    ls_calendar=GREGORIAN'))
    ERROR at line 1:
    ORA-14074: partition bound must collate higher than that of the last partition
    I checked the manual, but didn't find it written anywhere about restriction on column data type for Range partition or others.
    I doubt if creating range partitions on columns with varchar2 is allowed and if yes, not sure why I get that error

    Try to split first partition:
    alter table rs_ebpp.rs_mail_job_new 
    split partition p110201 at (to_date('2011-31-01 00:00:00', 'SYYYY-mm-dd hh24:mi:ss', 'nls_calendar=GREGORIAN'))
    into (partition p110131, partition p110201) ;

  • How to find out the min & max partition_id in a range partition?

    Hi we have a table set up by range partition
    In the table creation script. It goes something like:
    PARTITION PARTD_CUST_3_1_NEW VALUES LESS THAN ('39500')
    so how we can find out this number '39500' from some of the data_dictionary view?
    What we want to do is to set up parallel processing (do-it-yourself) based on partition.
    So the number of parallel process will be based on this ID-range.
    I can find out how many partitions are there by using something like this:
    SELECT COUNT(*)
    FROM all_tab_partitions WHERE table_owner='OWNER_NAME' AND table_name='TABLE_NAME'
    We have 5 partitions now but the table structure can change in the near future even this table has moer than 130Million rows
    I do not want to hardcode this "39500" just in case the table structure changes (partition structure changes)
    Any idea ??

    vxwo0owxv wrote:
    Hi we have a table set up by range partition
    In the table creation script. It goes something like:
    PARTITION PARTD_CUST_3_1_NEW VALUES LESS THAN ('39500')
    so how we can find out this number '39500' from some of the data_dictionary view?
    What we want to do is to set up parallel processing (do-it-yourself) based on partition.
    So the number of parallel process will be based on this ID-range.
    I can find out how many partitions are there by using something like this:
    SELECT COUNT(*)
    FROM all_tab_partitions WHERE table_owner='OWNER_NAME' AND table_name='TABLE_NAME'
    We have 5 partitions now but the table structure can change in the near future even this table has moer than 130Million rows
    I do not want to hardcode this "39500" just in case the table structure changes (partition structure changes)
    Any idea ??query DBA_TAB_PARTITIONS.HIGH_VALUE

  • ALV report requirement for peculiar SUBTOTAL

    The following table is required for ALV report for inventory calculation.
    The last column is the physical balance.
           No......A.......... B.......     C......D     (D=A+B-C)
            1......50........8........     2.......56     
            2...... 20.........3.........1......22     
            3.......56.........10.......6......     60     
         ........50........21......     9......     60  (SUBTOTAL ROW)     
    Requirement for the subtotal row:
    The subtotal for column A should be 50, It should take the first value 50 in the opening column in 1st row.
    The subtotal for D column should be 60, It should be same as the value 60, in the LAST row that is 60
    all other column subtotals are mathemetical totals as usual.
    thanx
    gaut
    Edited by: gautam gautam on May 6, 2009 1:31 AM

    Hi,
    Try this
    In side the loop
    at new matnr.
    capture the column1 (A)value into one variable
    at end of matnr
    capture the column 4 (D) value into one variable
    and print it in subtotal row
    Regards
    Krishna

  • Range partitioning of 3 columns

    Hello!
    I use Oracle 10g with SH schema.
    Now I want to create a new table SALES_SH that have range partition of 3 columns:
    create table SH.SALES_SH (PROD_ID NUMBER, CUST_ID NUMBER, TIME_ID DATE, CHANNEL_ID NUMBER, PROMO_ID NUMBER, QUANTITY_SOLD NUMBER(10,2), AMOUNT_SOLD NUMBER(10,2), COUNTRY_ID NUMBER, PROD_CATEGORY_ID NUMBER, FISCAL_YEAR NUMBER(4))
    PARTITION BY RANGE (FISCAL_YEAR, COUNTRY_ID, PROD_CATEGORY_ID)
    (PARTITION S_2000_GM_EL VALUES LESS THAN (2001,52789,203),
    PARTITION S_2000_GM_PA VALUES LESS THAN (2001,52789,205),
    PARTITION S_2000_GM_SO VALUES LESS THAN (2001,52789,206),
    PARTITION S_2000_UK_EL VALUES LESS THAN (2001,52790,203),
    PARTITION S_2000_UK_PA VALUES LESS THAN (2001,52790,205),
    PARTITION S_2000_UK_SO VALUES LESS THAN (2001,52790,206),
    PARTITION S_2000_US_EL VALUES LESS THAN (2001,52791,203),
    PARTITION S_2000_US_PA VALUES LESS THAN (2001,52791,205),
    PARTITION S_2000_US_SO VALUES LESS THAN (2001,52791,206),
    PARTITION S_2001_GM_EL VALUES LESS THAN (2002,52789,203),
    PARTITION S_2001_GM_PA VALUES LESS THAN (2002,52789,205),
    PARTITION S_2001_GM_SO VALUES LESS THAN (2002,52789,206),
    PARTITION S_2001_UK_EL VALUES LESS THAN (2002,52790,203),
    PARTITION S_2001_UK_PA VALUES LESS THAN (2002,52790,205),
    PARTITION S_2001_UK_SO VALUES LESS THAN (2002,52790,206),
    PARTITION S_2001_US_EL VALUES LESS THAN (2002,52791,203),
    PARTITION S_2001_US_PA VALUES LESS THAN (2002,52791,205),
    PARTITION S_2001_US_SO VALUES LESS THAN (2002,52791,206),
    PARTITION S_2002_GM_EL VALUES LESS THAN (2003,52789,203),
    PARTITION S_2002_GM_PA VALUES LESS THAN (2003,52789,205),
    PARTITION S_2002_GM_SO VALUES LESS THAN (2003,52789,206),
    PARTITION S_2002_UK_EL VALUES LESS THAN (2003,52790,203),
    PARTITION S_2002_UK_PA VALUES LESS THAN (2003,52790,205),
    PARTITION S_2002_UK_SO VALUES LESS THAN (2003,52790,206),
    PARTITION S_2002_US_EL VALUES LESS THAN (2003,52791,203),
    PARTITION S_2002_US_PA VALUES LESS THAN (2003,52791,205),
    PARTITION S_2002_US_SO VALUES LESS THAN (2003,52791,206));
    Here is the Data:
    INSERT INTO SH.SALES_SH
    SELECT SALES.PROD_ID, SALES.CUST_ID, SALES.TIME_ID, CHANNEL_ID, PROMO_ID, QUANTITY_SOLD, AMOUNT_SOLD, COUNTRY_ID, PROD_CATEGORY_ID, FISCAL_YEAR
    FROM SALES, CUSTOMERS, TIMES, PRODUCTS
    WHERE SALES.PROD_ID=PRODUCTS.PROD_ID AND SALES.CUST_ID=CUSTOMERS.CUST_ID AND SALES.TIME_ID=TIMES.TIME_ID
    AND (COUNTRY_ID=52790 OR COUNTRY_ID=52789 OR COUNTRY_ID=52776)
    AND (PROD_CATEGORY_ID=201 OR PROD_CATEGORY_ID=203 OR PROD_CATEGORY_ID=205)
    AND (FISCAL_YEAR=2000 OR FISCAL_YEAR=2001 OR FISCAL_YEAR=2002)
    ORDER BY FISCAL_YEAR, COUNTRY_ID, PROD_CATEGORY_ID;
    Note that, in Create table script, I use some "virtual value" (2003,52791,206) instead of MAXVALUE (because it get error)
    It run. But the partitions with "virtual value" have no data, and the others data is wrong!
    Please, help me! Thanks
    TRAN MAI

    OK. Here is the real data:
    SELECT distinct fiscal_year, country_id, prod_category_id from sales_sh partition(s_2000_gm_el) order by fiscal_year, country_id, prod_category_id;
    FISCAL_YEAR COUNTRY_ID PROD_CATEGORY_ID
    2000 52776 201
    2000 52776 203
    2000 52776 205
    2000 52789 201
    2000 52789 203
    2000 52789 205
    2000 52790 201
    2000 52790 203
    2000 52790 205
    2001 52776 201
    2001 52776 203
    FISCAL_YEAR COUNTRY_ID PROD_CATEGORY_ID
    2001 52776 205
    2001 52789 201
    13 rows selected.
    That mean, the PARTITION S_2000_GM_EL VALUES LESS THAN (2001,52789,203) get nearly all data.
    That mean, VALUES LESS THAN (2001,52789,203) <=> Fiscal_year<2001 OR Country_id<52789 OR Prod_category_id<203 (the "OR" condition), while I want the "AND" condition.
    Please, give me an advise! Thanks!
    TRAN MAI

  • Problem with a 2 columns Range Partitioning for a indexed organized table

    have an indexed organized table with a 2 column PK. the first field (datum) is a date field the second field (installatieid) is a number(2) field.
    Every minute a 7 records are inserted (installatieid 0-6).
    I like to partition this table with one partition per year per installatieid.
    I tried to do it with:
    partition by range(datum,installatieid)
    (partition P_2004_0 values less than (to_date('2004-01,'yyyy-mm'),1)
    ,partition P_2004_6 values less than (to_date('2004-01','yyyy-mm'),7)
    partition P_2005_0 values less than (to_date('2005-01','yyyy-mm'),1)
    ,partition P_2005_6 values less than (to_date('2005-01','yyyy-mm'),7)
    but now only the P_2004_0 and P_2005_0 are filled.
    I thought about to combine a range partition on datum with a list subpartition on installatieid, but I read this is not allowed with an index organized table.
    How can I solve this problem.

    partition by range(datum,installatieid)
    (partition P_2004_0 values less than
    (to_date('2004-01,'yyyy-mm'))
    ,partition P_2004_6 values less than
    (to_date('2004-07','yyyy-mm'))
    partition P_2005_0 values less than
    (to_date('2005-01','yyyy-mm'))
    ,partition P_2005_6 values less than
    (to_date('2005-07','yyyy-mm'))
    ? Sorry haven't got time to test it this morning ;0)

Maybe you are looking for