Range partitioning and update to range value

There is a V. large table on our system, where a column is initally set to NULL, but updated with sysdate when processed. The majority of qureies against this table are for those with NULL values. I'm considering range partitioning by this column, where all NULLs will appear in the one partition, all non_NULLs in the other. The questions are.....
1)will a row automatically move from one partion to the next on update of the NULL value
2) If so, what are the overheads

Using ENABLE ROW MOVEMENT will work, but the overhead of moving the rows is fairly high. If the date column is only updated once over the life of the record, then this overhead may be acceptable. However, if the date field is updated to sysdate most times the record is touched, then this may be a large performance hit.
You may want to investigate the use of a function based index to get the NULL dates indexed. A function like:
DECODE(date_field,NULL,1,NULL)
would create an index containing only the null rows. Then a query like:
SELECT stuff
FROM table
WHERE DECODE(date_field,NULL,1,NULL) = 1would likely do and index range scan.
TTFN
John

Similar Messages

  • Modify HUGE HASH partition table to RANGE partition and HASH subpartition

    I have a table with 130,000,000 rows hash partitioned as below
    ----RANGE PARTITION--
    CREATE TABLE TEST_PART(
    C_NBR CHAR(12),
    YRMO_NBR NUMBER(6),
    LINE_ID CHAR(2))
    PARTITION BY RANGE (YRMO_NBR)(
    PARTITION TEST_PART_200009 VALUES LESS THAN(200009),
    PARTITION TEST_PART_200010 VALUES LESS THAN(200010),
    PARTITION TEST_PART_200011 VALUES LESS THAN(200011),
    PARTITION TEST_PART_MAX VALUES LESS THAN(MAXVALUE)
    CREATE INDEX TEST_PART_IX_001 ON TEST_PART(C_NBR, LINE_ID);
    Data: -
    INSERT INTO TEST_PART
    VALUES ('2000',200001,'CM');
    INSERT INTO TEST_PART
    VALUES ('2000',200009,'CM');
    INSERT INTO TEST_PART
    VALUES ('2000',200010,'CM');
    VALUES ('2006',NULL,'CM');
    COMMIT;
    Now, I need to keep this table from growing by deleting records that fall b/w a specific range of YRMO_NBR. I think it will be easy if I create a range partition on YRMO_NBR field and then create the current hash partition as a sub-partition.
    How do I change the current partition of the table from HASH partition to RANGE partition and a sub-partition (HASH) without losing the data and existing indexes?
    The table after restructuring should look like the one below
    COMPOSIT PARTITION-- RANGE PARTITION & HASH SUBPARTITION --
    CREATE TABLE TEST_PART(
    C_NBR CHAR(12),
    YRMO_NBR NUMBER(6),
    LINE_ID CHAR(2))
    PARTITION BY RANGE (YRMO_NBR)
    SUBPARTITION BY HASH (C_NBR) (
    PARTITION TEST_PART_200009 VALUES LESS THAN(200009) SUBPARTITIONS 2,
    PARTITION TEST_PART_200010 VALUES LESS THAN(200010) SUBPARTITIONS 2,
    PARTITION TEST_PART_200011 VALUES LESS THAN(200011) SUBPARTITIONS 2,
    PARTITION TEST_PART_MAX VALUES LESS THAN(MAXVALUE) SUBPARTITIONS 2
    CREATE INDEX TEST_PART_IX_001 ON TEST_PART(C_NBR,LINE_ID);
    Pls advice
    Thanks in advance

    Sorry for the confusion in the first part where I had given a RANGE PARTITION instead of HASH partition. Pls read as follows;
    I have a table with 130,000,000 rows hash partitioned as below
    ----HASH PARTITION--
    CREATE TABLE TEST_PART(
    C_NBR CHAR(12),
    YRMO_NBR NUMBER(6),
    LINE_ID CHAR(2))
    PARTITION BY HASH (C_NBR)
    PARTITIONS 2
    STORE IN (PCRD_MBR_MR_02, PCRD_MBR_MR_01);
    CREATE INDEX TEST_PART_IX_001 ON TEST_PART(C_NBR,LINE_ID);
    Data: -
    INSERT INTO TEST_PART
    VALUES ('2000',200001,'CM');
    INSERT INTO TEST_PART
    VALUES ('2000',200009,'CM');
    INSERT INTO TEST_PART
    VALUES ('2000',200010,'CM');
    VALUES ('2006',NULL,'CM');
    COMMIT;
    Now, I need to keep this table from growing by deleting records that fall b/w a specific range of YRMO_NBR. I think it will be easy if I create a range partition on YRMO_NBR field and then create the current hash partition as a sub-partition.
    How do I change the current partition of the table from hash partition to range partition and a sub-partition (hash) without losing the data and existing indexes?
    The table after restructuring should look like the one below
    COMPOSIT PARTITION-- RANGE PARTITION & HASH SUBPARTITION --
    CREATE TABLE TEST_PART(
    C_NBR CHAR(12),
    YRMO_NBR NUMBER(6),
    LINE_ID CHAR(2))
    PARTITION BY RANGE (YRMO_NBR)
    SUBPARTITION BY HASH (C_NBR) (
    PARTITION TEST_PART_200009 VALUES LESS THAN(200009) SUBPARTITIONS 2,
    PARTITION TEST_PART_200010 VALUES LESS THAN(200010) SUBPARTITIONS 2,
    PARTITION TEST_PART_200011 VALUES LESS THAN(200011) SUBPARTITIONS 2,
    PARTITION TEST_PART_MAX VALUES LESS THAN(MAXVALUE) SUBPARTITIONS 2
    CREATE INDEX TEST_PART_IX_001 ON TEST_PART(C_NBR,LINE_ID);
    Pls advice
    Thanks in advance

  • How to select and duplicate the records and update some column values using cursor

    I have a table with 920 records, we need to update the end date to 6/30/2014 for 920 records and I need to create all 920 records with start date is 7/1/2014 and update the external value to
    CCC.
    Note: the table primary key is not auto increment, but I have sp to get the latest key for that.
    Existing table.  
    ID
    Source Name
    Internal value
    External value
    Start date
    End date
    1
    XXX
    AAA
    BBB
    1/1/2013
    6/30/2015
    Create new records
    ID
    Source Name
    Internal value
    External value
    Start date
    End date
    921
    XXX
    AAA
    CCC
    7/1/2013
    12/30/2015

    Hi ManuGT
    If I understand what you need then you ask for:
    1. updating all current rows (920 rows in the table now)
    2. insert new rows which are duplicates of the preiviews rows, but with value 'CCC' insteade of 'BBB'
    If so, there is not reason to use a cursor and it is highly NOT RECOMMENDED to use ant type of loop.
    You should work with SET and do it all in 2 simple queries:
    -- first we duplicate the existing rows,
    -- but we use the values 'CCC" and '20140107' for the new rows values
    INSERT test (SourceName, InternalValue, ExternalValue, StartDate, EndDate)
    select SourceName, 'CCC', ExternalValue, '20140107' , EndDate
    from test
    where
    -- You can use any filter that you need if you dont want to update all rows
    InternalValue = 'AAA' and ExternalValue = 'BBB' and StartDate = '20140101' and EndDate = '20140630'
    -- Now we update the old rows (check the filter! I get only the old rows since I filter the new rown out)
    UPDATE test
    SET EndDate = '20140107' -- I use date in format yyyymmdd, You can use other formats as well
    where
    -- You can use any filter that you need if you dont want to update all rows
    InternalValue = 'AAA' and ExternalValue = 'BBB' and StartDate = '20140101' and EndDate = '20140630'
    Unfortunately you did not post DDL+DML! Therefore we cant see your table structure and the data sample and we can only guess. I used Saeid's post as the basic DDL+DML.
    Please next time post DDL+DML
    here is the full code with the DDL+DML that i used:
    -- This is our DDL - A create table query:
    create table test
    ( id int identity(1,1) primary key,
    SourceName nvarchar(3),
    InternalValue nvarchar(3),
    ExternalValue nvarchar(3),
    StartDate date,
    EndDate date
    go
    -- This is our DML - A query that insert some sample data
    declare @i int = 1 ;
    while @i < 921
    begin
    insert test (SourceName, InternalValue, ExternalValue, StartDate, EndDate)
    values ('XXX', 'AAA', 'BBB', '1/1/2014', '6/30/2014' ) ;
    set @i += 1 ;
    end ;
    GO
    -- Here is the solution for the problem as I understood your needs:
    -- first we duplicate the existing rows,
    -- but we use the values 'CCC" and '20140107' for the new rows values
    INSERT test (SourceName, InternalValue, ExternalValue, StartDate, EndDate)
    select SourceName, 'CCC', ExternalValue, '20140107' , EndDate
    from test
    where
    -- You can use any filter that you need if you dont want to update all rows
    InternalValue = 'AAA' and ExternalValue = 'BBB' and StartDate = '20140101' and EndDate = '20140630'
    -- Now we update the old rows (check the filter! I get only the old rows since I filter the new rown out)
    UPDATE test
    SET EndDate = '20140107' -- I use date in format yyyymmdd, You can use other formats as well
    where
    -- You can use any filter that you need if you dont want to update all rows
    InternalValue = 'AAA' and ExternalValue = 'BBB' and StartDate = '20140101' and EndDate = '20140630'
    -- Here we just check how the result look like :-)
    select *
    from test ;
    -- And since we do not realy need this table in our server... Here we clean the DDL (you probaby DO NOT WANT TO EXECUTE THIS!)
    DROP table test
    GO
    I hope this was useful :-)
    [Personal Site] [Blog] [Facebook]

  • Range Partitioning a table. Max value to be defined

    Hi,
    I am using a range partitioned table, range partitioned on date, and have defined max value as 6 months after the Creation Date.
    I have a proc which creates the partitions I want in advance by splitting up the max partition.
    - Now what do I do when max partition is reached after 6 months?
    - If I define max partition one year or two year after the current date instead of the currently defined 6 months after creation date. What are the negatives attached with it?
    I can't use Interval Partition and have to use Range only.
    Kindly suggest.
    Thanks..

    >
    I am using a range partitioned table, range partitioned on date, and have defined max value as 6 months after the Creation Date.
    I have a proc which creates the partitions I want in advance by splitting up the max partition.
    - Now what do I do when max partition is reached after 6 months?
    - If I define max partition one year or two year after the current date instead of the currently defined 6 months after creation date. What are the negatives attached with it?
    >
    Any data with a partition key that does NOT match any partition will cause your INSERT query to fail.
    Any partition that has no data to match it will simply remain empty.
    A common partitioning scheme is to define one partition for all old data, one partition with a high max value and then split the max value partition to get the partitions you want in the middle.
    Let's say you want monthly partitions but don't have that much data from before the current year, 2012.
    1. Create one partition for dates < 1/1/2012
    2. One partition each for the 12 months of 2012
    3. One max value partition to be 1/1/4000
    You would just split the max value partition to create each month of 2013. The split could be done ahead of time or a month at a time as you choose.
    The only negative is that any data inserted by mistake that has a super-high date will go into the max value partition. But that is going to happen anyway. If you accidentally enter a date of 3/23/3882 it won't be rejected.
    But it is easy to query periodically to see if you have any 'bad' data like that. And the alternative is that an INSERT would fail because of the one bad record and all of your good data would be rejected anyway so it's not really much of a negative.
    Remember - for best management performance each partition should have its own tablespace and the indexes should all be local if possible.

  • List-range partition and subpartition

    Does anyone know that Oracle 10g support partition by list and subpartition by range? Thanks.

    check the documentation link [http://download.oracle.com/docs/cd/B19306_01/appdev.102/b31695/dialogs.htm#sthref441]
    hope you will find your answer on link page.

  • VO query with SQL table function (MS SQL) and update of parameter value

    Hello All,
    I use VO where Query is the SQL function that returns a table (MS SQL Server):
    select * from getData('XXXX')
    where ‘ХХХХ’ should be binded to the specific ID (e.g. selected row in the tree view on the another facet).
    More details: I have two facets. Left facet contains a tree view that displays the list of the projects grouped by industry. Right facet contains a pivot table (source query is a ‘table function’ from above).
    I want to have the pivot table (right facet) to be updated with the data specific to the project (selected row in the tree).
    I know about the possibility to dynamically update the where clause (setNamedWhereClauseParam method), but in my case there is no ‘where’ clause. Is there any kind of ‘bind variable’ to be used to refresh the data?
    Any guidance, ideas, examples are greatly welcome.
    With best wishes,
    Anatol

    Are the columns that are being selected different each time or the same?
    If they are the same then you don't need to do any additional binding - the pivot table is connected to the VO at design time and it wouldn't care if the underlying from/where have changed.
    If on the other hand your columns change (but the number of them stay the same) then use aliases for the initial definition (select ename a, id b, salary c) and then when you change the VO change the mapping but keep the names (select dname a, moo b, foo c).
    If the whole query is changing and you don't know in advance the structure - then there is no out of the box solution with a pivot table - you'll need to code a backing bean that will provide the data model to the pivot table based on your query.

  • About range partition

    Dear Friends ,
    I am using Oracle10g . I have to create a range partition like below :
    CREATE TABLE EMP
    EMPNO NUMBER(4),
    ENAME VARCHAR2(10 BYTE),
    JOB VARCHAR2(9 BYTE),
    MGR NUMBER(4),
    HIREDATE DATE,
    SAL NUMBER(7,2),
    COMM NUMBER(7,2),
    DEPTNO NUMBER(2)
    PARTITION BY RANGE(hiredate)
    PARTITION emp_1980 VALUES LESS THAN(TO_DATE('31/12/1980','DD/MM/YYYY')) TABLESPACE USERS,
    PARTITION emp_1981 VALUES LESS THAN(TO_DATE('31/12/1981','DD/MM/YYYY')) TABLESPACE USERS,
    PARTITION emp_1982 VALUES LESS THAN(TO_DATE('31/12/1982','DD/MM/YYYY')) TABLESPACE USERS,
    PARTITION emp_1987 VALUES LESS THAN(TO_DATE('31/12/1987','DD/MM/YYYY')) TABLESPACE USERS
    But the problem is :
    1) if any input data is not match with the above criteria then where it goes ? i mean , the data which dont follow the above rule which partition it goes ? is there any way to set DEFAULT partition option in the range partition ?
    I only find the DEFAULT option in LIST partition
    2) Barring this , when I add a new partition with the above then it shows the below error :
    alter table emp add partition emp.emp_1988 VALUES LESS THAN(TO_DATE('31/12/1988','DD/MM/YYYY')) TABLESPACE USERS
    Error :
    "ORA-14020: this physical attribute may not be specified for a table partition" ,
    Would anybody plz help me , How can I solve the above problems ?

    Range Partitioning provides for a range of values. Therefore, any value higher than the maximum value provided in your partition definitions would fail. Thus, for example, 01/01/1988 and above would error. That is why Range Partitioning allows you to specify a "highest" values possible where you say "values less than (MAXVALUE)". Therefore, if you had included an "emp_maxvalue" partition with "values less than (MAXVALUE)" after the "emp_1987" partition, any value for 1988 or higher would go into the emp_maxvalue partition.
    { Since there is no minvalue specified, a value of, say, 01/06/1979 would go into the "emp_1980" partition as it is "less than (01/01/1980)" ! }
    Again, as Partitioning is a Range of Dates, you cannot add a partition. You have to SPLIT a partition. For example, if you had an "emp_maxvalue" partition present, in order to create the emp_1988 partition, you would SPLIT "emp_maxvalue" into two partitions : emp_1988 and emp_maxvalue.
    Please read the documentation on Partition Maintenance in the Administrator's Guide.
    Hemant K Chitale
    http://hemantoracledba.blogspot.com

  • Doubt in partition and subpartition

    hi gems...good afternoon...
    I have a doubt redgarding partitioning and subpartitioning...This may be a silly question, but i am really not getting this...please help me..
    I have a table which has Range-Hash composite partitioning.
    The Range partitioning is on the default tablespace TS_PROD (because I didnt mention any tablespace name in the Range partitions).
    The Hash subpartitioning are on the corresponding partition tablespaces (TS_PART1,TS_PART2,TS_PART3....TS_PART6).
    I have created total 8 Range partitions and the number of Hash subpartitions are 6 for each of them.
    Now when I query the DBA_TAB_PARTITIONS, then I got the desired output i.e. all the Range partitions are in the default tablespace.
    When I query the DBA_TAB_SUBPARTITIONS, then also I got the desired output i.e. all the Hash subpartitions are in the separate partition tablespaces.
    But when I have inserted data in that table, then I found that both the default tablespace and partition tablespaces are getting filled up.
    Moreover, the sum of the increase in sizes of the partition tablespaces is equal to the increase in default tablespace.
    I am not getting the concept of this. Where are the datas are getting stored??? In the default tablespace or in the partition tablespaces??
    Thanks a lot in advance..

    thanks a lot RP for your reply...
    and sorry for the late and miscommunication...
    Actually i am not so experienced in the DBA line and in my company suddenly my senior DBA left and i am the only one here...I got tensed... :( :(
    I have started reading documentation of Oracle, have started the Administrator's Guide first...
    Anyways...now i got the concept of the partitioning and subpartitioning i was doing...
    The mistake which I was doing is: I was not mentioning the primary key index tablespace and that segment is going into the default tablespace and thats why the size was increasing for both default tablespace and partitioned tablespaces. Because of that fact I was getting confused again and again.
    As soon as I mentioned the primary key index tablespace, the size of the default tablespace stopped increasing...
    Now the script from which I am getting the size of the tablespaces: (join of dba_datafiles and dba_free_space)
    select /* + RULE */ t.tablespace, t.totalspace as " Totalspace(MB)",
    round((t.totalspace-fs.freespace),2) as "Used Space(MB)",
    fs.freespace as "Freespace(MB)",
    round(((t.totalspace-fs.freespace)/t.totalspace)*100,2) as "% Used",
    round((fs.freespace/t.totalspace)*100,2) as "% Free"
    from
    (select round(sum(d.bytes)/(1024*1024)) as totalspace, d.tablespace_name tablespace
    from dba_data_files d
    group by d.tablespace_name) t,
    (select round(sum(f.bytes)/(1024*1024)) as freespace, f.tablespace_name tablespace
    from dba_free_space f
    group by f.tablespace_name) fs
    where t.tablespace=fs.tablespace
    order by t.tablespace;
    Thanks a lot RP for your help... :)

  • HtmlDataTable (seem to be) not updating HtmlSelectOneListBox model values

    I have a table with multiple rows of model objects in a list. One of the controls in the row is a selectone list box with its own list of selectItem objects
    On submit and back, any text controls I have in the table and also in the form are retaining their state and updating the model values
    But the selctone list box is not updating the models?
    If I follow the phase events I see the update model phase passing through. Not sure why the data in the ui is not submitted to the model
    If I locate the ui control and ask its selected value I see the changed value. But this is not communicated to the the model.
    Is there a known issue with a data table and select drop downs, especially for keeping the state.
    The backing bean is session scope where the data for the table is maintained as a list of pojo objects. The drop down values are kept in a list of SelectItem objects
    Thanks in advance for help
    Satya

    In short, my fault.
    I have the list items bound to a list. But the I haven't bound the HtmlSelectOneList box with a value binding. I was under the impression that the selected item from this list is kept with the item as in the case of html. But in this case it is kept with the parent via its value attribute.
    Now the state is kept as the form goes back and forth.

  • Add zfield to va01 and updating the data base

    Hi friends,
    I have requirement to add Zfields to vbak and updating the Zfield value to VBAK.
    But my problem is when am trying to save or changing the Zfield into data base it is not saving the zfield value and it is not detecting the change value of Zfield in VA02.
    Can any provide the solution if possible.
    Thanks in advance.
    sasi.

    Hi friend ,
    my requirement to update the Zfield information in vbap table. Even if am try using the user exit move_field_to_vbap it is not getting triggered if we chage the zfield value.it is only getting triggered during the change of standard field.
    when am trying to save the Zfield value we are getting the message No data changed. in that case data is not getting updated to data base table vbap
    thanks  in advance,
    sasi.

  • How to use KAUF_AUFNR_CHANGE  to change Process order and Update a field

    Hello ,
    I am working on 4.6C system and I hve a requirement to change Process order and Update a field value passed from a ABAP Program. I am looking for suitable Function modules or Bapi ( available in 4.6c) .
    I have come across FM KAUF_AUFNR_CHANGE . Would appreciate any guidance on how to use the FM in my program and Update a field in the Process order.
    Many Thanks!

    All the importing parameters of this function module have a striaght structure of the transperent tables...
    i have checked the code and it has a modify statement based on the importing parameter..
    pick one record in databas and pass it to the importing parameters, with some values changed...
    i think that should work
    what values  to pass the import values of FM -KAUF_AUFNR_CHANGE.
    Edited by: ssm on Aug 4, 2011 7:19 PM

  • 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;
      

  • Range - Interval Partition and List Subpartition.

    Hi
    I am trying to create the Range(Interval) Partition with List Sub partition (dynamically). Here the LOCATION_CD List is Dynamic. Basically Location_CD is Country name. e.g USA, IND,GER.....
    Below Works good...
    CREATE TABLE TEMP
    SEQUENCE_ID NUMBER,
    RESERVATION_DATE TIMESTAMP,
    LOCATION_CD VARCHAR2(5)
    PARTITION BY RANGE (RESERVATION_DATE)
    INTERVAL (NUMTOYMINTERVAL(1,'MONTH'))
    SUBPARTITION BY LIST(LOCATION_CD)
    SUBPARTITION TEMPLATE
    ( SUBPARTITION CD_01 VALUES ('USA'),
    SUBPARTITION CD_02 VALUES ('IND'),
    SUBPARTITION CD_03 VALUES ('GER')
    PARTITION TEMP values LESS THAN (TO_DATE('01-JAN-2000','DD-MON-YYYY'))
    Today there are 3 Countries but going forward it can be more or less.
    I like the Interval Range Partition concept, where the new partition is automatically gets added.
    But at the same time can the new list sub partition be added ? If this doesn't work...can we have another alternative approach or partition technique ?
    Please suggest.
    Thanks
    Jitesh R.

    Why didn't you just perform two inserts and answer the question yourself?
    orabase> CREATE TABLE T (
      2  SEQUENCE_ID      NUMBER,
      3  RESERVATION_DATE TIMESTAMP,
      4  LOCATION_CD      VARCHAR2(5))
      5  PARTITION BY RANGE (RESERVATION_DATE)
      6  INTERVAL (NUMTOYMINTERVAL(1,'MONTH'))
      7  SUBPARTITION BY LIST(LOCATION_CD)
      8  SUBPARTITION TEMPLATE (
      9  SUBPARTITION CD_01 VALUES ('USA'),
    10  SUBPARTITION CD_02 VALUES ('IND'),
    11  SUBPARTITION CD_03 VALUES ('GER')) (
    12  PARTITION root values LESS THAN (TO_DATE('01-JAN-2000','DD-MON-YYYY')));
    Table created.
    orabase> insert into t values (1, TO_DATE('02-JAN-2000'), 'USA');
    1 row created.
    orabase> select partition_name, subpartition_name
      2  from user_tab_subpartitions
      3  where table_name = 'T';
    PARTITION_NAME                 SUBPARTITION_NAME
    ROOT                           ROOT_CD_03
    ROOT                           ROOT_CD_02
    ROOT                           ROOT_CD_01
    SYS_P84                        SYS_SUBP83
    SYS_P84                        SYS_SUBP82
    SYS_P84                        SYS_SUBP81
    6 rows selected.
    orabase>  insert into t values (1, TO_DATE('02-JAN-2000')+400, 'USA');
    1 row created.
    orabase> select partition_name, subpartition_name
      2  from user_tab_subpartitions
      3  where table_name = 'T';
    PARTITION_NAME                 SUBPARTITION_NAME
    SYS_P88                        SYS_SUBP85
    SYS_P88                        SYS_SUBP86
    SYS_P88                        SYS_SUBP87
    SYS_P84                        SYS_SUBP81
    SYS_P84                        SYS_SUBP82
    SYS_P84                        SYS_SUBP83
    ROOT                           ROOT_CD_01
    ROOT                           ROOT_CD_02
    ROOT                           ROOT_CD_03
    9 rows selected.

  • HT1338 I have a Callaway range finder and need a software update and they provided the following directions and have changed the Java runtime versions several times to get their exe to update.Hello Doug,  Thank you for contacting Callaway uPro Technical S

    Hello Doug,
    Thank you for contacting Callaway uPro Technical Support.
    Please follow the instructions below to sync your upro mx/mx+ with your computer and update to the latest software - 3.1.005.
    1. Ensure the upro sync software is running on your computer (you will see a black icon at the bottom right of your screen by the clock with a Callaway logo in it).
    2. Plug your device into your computer; select Sync then PC.
    3. The sync software should initialize and launch the uxplore website. If you haven't installed the upro sync software you can download it Here:http://www.callawayuxplore.com/downloads/
    4. Download this: http://media.callawaygolf.com/webupdate/callawaygolf/2012/products/accessories/u pro/upro-mx-plus/downloads/3_1_005_launch.jnlp.zip
    5. Double click "3_1_005_launch," then click the green START button
    NOTE: If you get a "Unable to launch application" error please follow the instructions below.
    1a. Navigate to "Control Panel" through the start menu located in the bottom left of your screen.
    2a. Find and uninstall any "Java" applications. After uninstalling please go back to the start menu and right click on "Computer" or "My Computer" and select "Properties". In the right half of the pop up windows it'll say the Operating system your computer is running. If it says x64 bit click: http://tinyurl.com/lhkps2rto download the correct java for your computer. If it doesn't have a number please click: http://tinyurl.com/qysyctb to download the correct Java.
    3a. Once the correct Java is installed please follow steps 1-5 listed above.
    4a. To update your Java back to 7 please click: http://java.com/en/download/index.jsp. Once on the page select "Free Java Download" to run the download (Make sure to uncheck any Mcafee or toolbar installations during the installation).
    Once the update has completed the device will restart itself. At that time you can unplug it or select Sync and PC to launch the uxplore site again to continue syncing courses.
    NOTE: Do not try to sync courses to the unit while the update is running or both processes will fail. 

    Java isn't a part of the Mac OS X anymore, so you will need to install a version of Java. However, I don't know what version of java is required for this software. You need to explain to their support that you are using a Mac and what OS you are running. Download the latest java and see if that works.

  • Range partition by a virtual column derived from XMLTYPE

    I want to create table and partition it by interval partion (range partition) on a virtual column which is derived from XMLTYPE i get ora-14513 error.
    create table dicom_archive_virtual
    id integer not null primary key,
    parent_id integer, -- where this image is created from
    dcm_filename varchar2(60), -- DICOM image file name from import
    description varchar2(100), -- description of the image
    dicom orddicom, -- DICOM data
    image ordimage, -- DICOM data in JPEG format
    thumb ordimage, -- DICOM data in JPEG thumbnail
    metadata xmltype, -- user customized metadata
    isAnonymous integer, -- accessible flag for the research role.
    study_date date as
    (to_date(substr(extractValue(metadata,'//DATE/text()'),1,10),'yyyy-mm-dd')) virtual)
    PARTITION BY RANGE (study_date)
    INTERVAL(NUMTOYMINTERVAL(1, 'MONTH'))
    ( PARTITION p_2005 VALUES LESS THAN (TO_DATE('1-1-2006', 'DD-MM-YYYY')),
    PARTITION p_2006 VALUES LESS THAN (TO_DATE('1-1-2007', 'DD-MM-YYYY')),
    PARTITION p_2007 VALUES LESS THAN (TO_DATE('1-1-2008', 'DD-MM-YYYY'))
    Study_date is a virtual colum which is derived from the column metadata which is of type XMLTYPE,so when i partition on this virtual column i get the follwoing error
    SQL Error: ORA-14513: partitioning column may not be of object datatype
    So i want to know whether this is not possible or there is any other alternative to achieve this.

    I want to create table and partition it by interval partion (range partition) on a virtual column which is derived from XMLTYPE Congratulations on trying to fit as many cutting edge techniques into a single line as possible.
    So i want to know whether this is not possible ...The error message is pretty unequivocal.
    ...or there is any other alternative to achieve this.What you could try is materializing the virtual column, i.e. adding an actual date column which you populate with that code in the insert and update triggers. Inelegant but then complexity often is.
    Cheers, APC
    blog : http://radiofreetooting.blogspot.com

Maybe you are looking for

  • Error while deploying EAR file on OC4J 10.1.3.3

    Hi all, I am facing following error on OC4J while deploying EAR file Error occurred during initialization of VM Could not reserve enough space for object heap 07/12/31 17:47:21 oracle.oc4j.admin.internal.DeployerException: Error compiling :C:\exp\war

  • Time Machine backup failure on 60Gb iPhoto Library on second partition

    I had 1 partition on my Macbook Pro (2010). I have several users on the mac and I use fast switching for them. All users use same iPhoto Library and iTunes Media - they are situation in a separate folder in my partition root. My Time Capsule was setu

  • SCSI to USB

    Is there a way of transferring photo files from Power Mac G3 to my Imac G5? (the floppy drive on the G3 no longer works) Is there a SCSI to USB cable available?

  • Production order release

    Dear Experts Good Afternoon I have small query regarding production order release when ever i try to release a production order system give following message System status WCRE is active (ACT 20030197 0010) and system status of work center is CRTD WC

  • Duriong Voice Chat Voice is not Receiving from Creative Sound Card but going correct

    Hi! I have recently faced a problem in my Creative Sounce Card. When i play a sound, no? sound is coming from sound card, No?error message is coming but monitor screen is displaying the sound animations in?Windows media player. I have also tested my