How to Implement 30 days Range Partitioning with Date column. Not Interval

Hi,
I am using the db:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit
Current table structure is:
CREATE TABLE A
a NUMBER,
CreationDate DATE
PARTITION BY RANGE (CreationDate)
INTERVAL ( NUMTODSINTERVAL (30, 'DAY') )
(PARTITION P_FIRST
VALUES LESS THAN (TIMESTAMP ' 2001-01-01 00:00:00'))
How can I define virtual column based partitioning with RANGE partitioning without using INTERVAL partitioning.
And that is with Intervals of 30 days.
For monthly I am trying as
CREATE TABLE A
a NUMBER,
CreationDate DATE,
monthly_interval date as (to_char(CreationDate,'MM-YYYY')) VIRTUAL
PARTITION BY RANGE (monthly_interval)
partition p_AUG12 values less than (to_date('08-2012','mm-yyyy')),
partition p_SEP12 values less than (to_date('09-2012','mm-yyyy')),
partition p_OCT12 values less than (to_date('10-2012','mm-yyyy'))
Enable ROw Movement
BUT CAN'T INSERT the data even for that:
Insert into a (a, CreationDate)
Values (1, '12-10-2012')
Insert into a (a, CreationDate)
Values (1, '12-10-2012')
Please suggest..

Hi rp,
Interval Partitioned to Range. Created Daily Partitions from Monthly Part. got complicated so I am posting here.
Basically,
I know Interval Partitioning is a kind of Range partitioning. But explicitly for Interval Partitioned tables XML Indexes are not allowed as discussed here:
XMLIndexes on an Interval Partitioned Table??
I can do monthly partitions as :
CREATE TABLE A
a NUMBER,
CreationDate DATE,
monthly_interval varchar2(8) as (to_char(CreationDate,'MM-YYYY')) VIRTUAL
PARTITION BY RANGE (monthly_interval)
partition p_AUG12 values less than ('09-2012'),
partition p_SEP12 values less than ('10-2012'),
partition p_OCT12 values less than ('11-2012')
) Enable ROw Movement
Insert into a (a, CreationDate)
Values (1, '12-SEP-2012')
Insert into a (a, CreationDate)
Values (1, '14-SEP-2012')
Select * from A partition (p_SEP12)
Select * from A partition (p_AUG12)
Select * from A partition (p_OCT12)
Can we do it for 30 days partitions, instead of the monthly partitions. ANY suggestions..
Thanks..

Similar Messages

  • How to check the integer value with Date Column

    Hi Friends,
    I have a filter called 'Days'. I need to show the data based on the Days filter (Example : 2 Days).
    Example Query:
    Select * from Tb1
    Where EndDate(Value as '03/05/2013' > Days ( value as 2)
    How to handle the above scenario.
    Thanks in Advance....
    Regards,
    LuckyAbdul

    what meanings does it make. how can you compare a date to day count. Or is the inetger value an offset ie say 2 days from today etc?
    If yes you can use like below illlustration
    DECLARE @DayOffset int
    SET @DayOffset = 2
    SELECT *
    FROM TAble
    WHERE ENdDate >= DATEADD(dd,DATEDIFF(dd,0,GETDATE()),@DayOffset+1)
    refer
    http://visakhm.blogspot.in/2010/01/some-quick-tips-for-date-formating.html
    Please clarify with an example what you're expecting if its different from the above.
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to declare a bind variable with 'date' data type in command prompt?

    how to declare a bind variable with 'date' data type in command prompt?
    sql>variable q date;
    when i execute it show list of datatypes

    Hi,
    As Lokanath said, there are no DATE bind variables.
    You can use a VARCHAR2 bind variable, and convert it to a DATE in your SQL statment.
    If you're using SQL*Plus, consider a substitution variable. It won't be as efficient as a bind variable, but it will be as convenient.
    For example:
    DEFINE  first_entrry_date = "DATE '2010-06-20''
    SELECT   ...
    WHERE   entry_date >= &first_entry_date
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to transport/move a table with data from development to Test to Production

    Hi,
    How to transport/move a table with data from development to Test to Production..? Export-Import a Delivery Unit does only the structure and not the data
    Reg
    Sri

    Hi Sri,
    You cannot transport Data via Transport route in HANA, you can only transport code changes/Structure via DU. For Data movement, you either have a do a export/import from a flat file or replication from a Source System to HANA.
    Thanks Much,
    Abhishek

  • How to implement list of values with bind parameters

    Hi All,
    Please give me details about how to implement list of values with bind parameters.
    I have implemented with below things.
    1) created lov view object with query like select meaning, lookup_code from fnd_lookup_values where lookup_type=:1;
    2) The above vo added to applicationa module.
    3) created Controller class in the co class written code in processRequest();
    String vLookupType=pageContext.getParameter("LookupType");
    Serializable params={vLookupType};
    am.invokemethod("Initialize",params);
    4) In AM Impl Class invoke the VO
    5) In VO Impl class executed the query..
    But the above process working fine but when i give the value in lov text field like 'C' then press tab button the result will not showing instead of that i am getting error message, i want to implement standard lov functionality while implementing query with bind parameter.
    any thing reqired to add the code to controller for search criteria..
    Thanks
    Mateti

    Hi
    i am getting error as
    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT * FROM (SELECT meaning, lookup_code,lookup_type
    FROM fnd_lookup_values
    WHERE view_application_id = 200) QRSLT WHERE (lookup_type=:1 AND ( UPPER(MEANING) like :2 AND (MEANING like :3 OR MEANING like :4 OR MEANING like :5 OR MEANING like :6)))
    Thanks
    Mateti

  • In power mac g5, how to take Automatic Screen Shot with Date

    in power mac g5, how to take Automatic Screen Shot with Date ?
    please help me

    If you are standing by, and activating the process by keyboard
    you could be sure to include the open Date Time menu bar
    image in a complete screenshot, using cmd shift 3. Or outline
    the area you want if not full-screen, by using cmd shift 4.
    The command button may also have an apple icon on it.
    So that's the three key shortcuts for full & partial screen.
    For a more automated method, perhaps try using software to
    run an AppleScript, like Automator. Then write a script or find
    one that you can modify to do tasks and test it.
    There may be other methods, however identifying your intent
    would be higher on the list at this time; to narrow the method.
    Good luck & happy computing!

  • How to implement this aggregate logic at target column in odi inteface mapp

    sum(NOTICES) over ( partition by property order by RELAVANTDATE range between interval '30' day preceding and current row)
    how to implement this aggregate logic at target column in odi inteface mappings

    Hi
    if you don't want to aggregate try to define a user function
    analytic_sum($(value))
    implémented by
    sum($(value))
    after that
    replace your
    sum(NOTICES) over ( partition by property order by RELAVANTDATE range between interval '30' day preceding and current row)
    by
    analytic_sum(NOTICES) over ( partition by property order by RELAVANTDATE range between interval '30' day preceding and current row)

  • Range Partitioning on Varchar2 column???

    We hava table and it has a date column and its type is varchar2.
    This column's format is '16021013' ('ddmmyyyy').
    We want to make range partition on this column. What will be the best way?
    do you think virtal column partitioning will be efficient?

    >
    I'm not a new DBA:-) You can be sure. I asked only about range partitioning trick with varchar2 column because we did our examination about this table. We will need to archive this table quarter by quarter to the other archive database. Then, off course, nearly all queries are coming firstly by using this date column and they can have different filtering inside "where" conditions. Already, this table has index on this column but with huge number of data, index performance is not enough for us. This is a 7x24 banking system and we are lately joined to this project. Because of this, we cant change everything like changing data type of that column after this moment.
    >
    You are taking things way too personally. No one said anything about whether you were, or were not, a DBA or made any other comments about your skill or abilities.
    What we ask was for you to tell us WHAT the problem was that you were trying to solve and WHY you thought partitioning would solve it.
    And now, after several generic posts, you have finally provided that information. We can only comment based on the information that you post. We can't guess as to what types of queries you use or what kinds of predicates you use in those queries. But we need to know that information in order to provide the best advice.
    Next time you post put the important information in your original question:
    1. A table column is VARCHAR2 but contains a date value. We are unable to change the datatype of this column.
    2. We need to archive data quarterly based on this date value
    3. Nearly all queries use this date value and then also may have additional filter conditions
    4. This date column is indexed but we would like to improve the performance beyond what this index can give us.
    The above is a summary that includes all important information that is needed to know how best to help you.
    And I made a pretty good guess since two replies ago I provided you with example code that shows just how to partition the table.
    >
    Now, our only aim is how to make range partitioning this varchar2 date column.
    >
    As I showed you in my example code earlier you can add a virtual column to the table and partition on it. My example code creates a monthly partitioned table that allows you to archive by month or archive every three months to archive by quarter.
    You can modify that example to use quarterly partitions if you want but I would recommend that you use standard monthly partitions since they will satisfy the widest range of predicates.

  • 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

  • How to find out each Cell having Data or Not in Excel File by Using WDJ

    Hi Friends,
    I have one doubt on WDJ.
    I have to Upload Excel File. Click on Upload Button in Excel file Data will move to One Bapi. This is I was done. But my Requirement is if any empty Cell in Excel That File not uploaded it display one error message Please upload Correct Excel File
    How to find out each Cell having Data or Not in Excel File by Using WDJ. Please tell me.
    By Using this Code I have Upload Excel File
    InputStream text = null;
         int temp = 0;
         //wdComponentAPI.getMessageManager().reportSuccess("filePath Vijay:::");
         try
                   File file = new File(wdContext.currentContextElement().getResource().getResourceName().toString());     
    FileOutputStream op = new FileOutputStream(file);
                   if (wdContext.currentContextElement().getResource()!= null)
                          text = wdContext.currentContextElement().getResource().read(false);
                             while((temp=text.read())!= -1)
                                  op.write(temp);
                                  op.flush();
                                  op.close();
                                  path = file.getAbsolutePath();
                                  //wdComponentAPI.getMessageManager().reportSuccess("Path Name :::::"+path);
         catch(Exception ex)               
                   ex.printStackTrace();
    But my Requirement is If excel having any Empty Cell that excel file not uploaded.How to do this...
    Regards
    Vijay Kalluri

    Hi my friend
    I would like to share you some APACHE APi´s that i use when i have to read excel files in Web Dynpro.
    JAR = poi-3.2-FINAL-20081019.jar
    Some Example:
    POIFSFileSystem fs;
    HSSFWorkbook wb;
    HSSFSheet sheet;
    String myMexican_ValueFromExcelis = "";
    try {
             fs = new POIFSFileSystem(new FileInputStream();
             // and select the cell "y"
            cell = row.getCell( 0 );
            myMexican_ValueFromExcelis = cell.getCellValue();  
    }cach(Exception e){
    REgargds

  • How to know the PO  Created with RFQ or Not..??

    Hi MM Gurus,
    How to know the purchase order created with one quotation or not. because when i am trying to create PO with /ME21N through DOcumen Overview on. there is list of Quotation. i created PO with XYZ quotation. and after creation of PO i am trying to create another PO with another quotation but in that list still XYZ quotation is Displying. so how to knows once PO cretd with Quotation or not. . and I dont wanted to disply quotation once created Po.
    Thanks in Advance.
    N.A.Reddy

    Hi Pradeep. Thanks for the mail.
    the problem is ....with *quotation...*
    How to know the purchase order created with one quotation or not.
    because when i am trying to create PO with /ME21N through DOcumen Overview on. there is list of Quotation.
    I created PO with XYZ quotation. and after creation of PO i am trying to create another PO with another quotation but in that list still XYZ quotation is Displying.
    so how to knows once PO cretd with Quotation or not. .
    and I dont wanted to disply quotation once created Po.
    Thanks in Advance.
    N.A.Reddy

  • How to implement this ina partition table

    Hi Friends,
    I've some issue. Let me explain it -
    I've one table named -
    CREATE TABLE syst_part
       tx_id   NUMBER(5),
       begdate DATE  --begdate will be always system date
    );1) Every day i need to keep only 3 days data. So, at the start of the program i need to delete all the data which is more than 3 days old. The volume of this deleted record will be at least 1 million.
    2) Now i've to insert data which is coming through various process. And, it's volume will be also 1 million.
    So, i want to implement this in a partitioned approach by taking only 4 partition say part1, part2, part3 and part4 based on the begdate.
    And, i would like to reuse these partition to run my process for next 5 years(Forget about this time frame).
    I need to truncate only the partition which holds (sysdate - 3) data.
    The advantage will be - in this method i guess it would be faster to remove those old data from the table.
    Can this be achieved by using partition?
    I'm not sure about the method of reusing this partition alternatively as they appears free.
    Thanks in advance for your reply.
    Regards.
    Satyaki De.

    Thanks Rossi for your reply.
    The main reason of using the limited partition alternatively is - i can easily find the empty partition.
    SQL>
    SQL> ed
    Wrote file afiedt.buf
      1  SELECT i.table_name, s.index_name, s.tablespace_name, s.partition_name, s.status, s.num_rows
      2  FROM user_ind_partitions s, user_indexes i
      3* WHERE s.index_name = i.index_name
    SQL> /
    TABLE_NAME                     INDEX_NAME                     TABLESPACE_NAME                PARTITION_NAME                 STATUS     NUM_ROWS                                                        
    M                              MX                             ERSDATA                        P1                             USABLE            0                                                        
    M                              MX                             ERSDATA                        P2                             USABLE            0                                                        
    M                              MX                             ESSDATA                        SYS_P82                        USABLE            0                                                        
    SQL> spool offFrom num_rows column i can get the empty one.
    Regards.
    Satyaki De.

  • How to use a 2nd partition for data storage?

    The 40 GB hard disk on my satellite L10 was delivered with two 20 GB partitions (drive C and D). I now understand (by reading this forum) that it is preferred to use one partition for data storage.
    Until now there was no need to use the D-drive. But by now I need the extra space.
    How can I use the folders structure in windows XP home (My Documents etc) and put the data on the D-drive.
    We work on this computer with several accounts.
    I tried to move one folder out of My Documents to the D-drive, but then it can be reached by the other users. Should I use shortcuts towards the D-drive? I hope there is a simple solution.
    Thanks in advance.
    (I tried my best to write this in English....)

    Hi
    I didnt tried it before but you can try to make your personal folder on D partition. The notebook administrator should set the security settings that can be found under folder properties. Go to Security tab and check all permissions for other users. Choose Deny option for all of them.
    I believe that on this way you can use your data folder alone and be sure that other users can not read or execute any of your private data.
    Please let me know if it works properly.
    Bye

  • How to implement parent entity for core data

    Hi there.
    I am starting a document-based Core Data application (Cocoa) and developed the following data model;
    The 'invoice' entity is a parent entity of 'items', because ideally I would want there to be many items for each invoice. I guess my first point here is - is what I am trying to do going to be achieved using this method?
    If so, I have been trying several ways in Interface Builder to sort out how to implement this structure with cocoa bindings. I have made a Core Data app before, just with one entity. So this time, I have two separate instances of NSArrayController's connected to tables with relevant columns. I can add new 'invoice' entities fine, but I can't get corresponding 'items' to add.
    I tried setting the Managed Object Context of the 'item' NSArrayController to this;
    I thought this would resolve the issue, but I still have found no resolution to the problem.
    If anyone done something similar to this, I'd appreciate any help
    Thanks in advance,
    Ricky.

    Second, when you create a Core Data Document Based application, XCode generates the MyDocument class, derivating from NSPersistentDocument. This class is dedicated to maintain the Managed Object Model and the Managed Object Context of each document of your application.
    There is only one Context and generally one Model for each Document.
    In Interface Builder, the Managed Object Context must be bound to the managedObjectContext of the MyDocument instance: it's the File's owner of the myDocument.xib Nib file.
    It's not the case in your Nib File where the Managed Object Context is bound to the invoiceID of the Invoice Controller.
    It's difficult to help you without an overall knowledge of your application, perhaps could you create an InvoiceItem Controller and bind its Content Set to the relationship of your invoice.

  • How to use "Days to keep historical data" & "Maximum time between logs(hh:mm:ss)

    Iam using LabVIEW DSC. Values are being logged continously into citadel.
    Is it possible to retain data of just one month and delete the earlier data as fresh data is being logged into citadel?
    Is it possible to achieve this feature with "Days to keep historical data" & "Maximum time between logs(hh:mm:ss)" options in the history menu of Tag configuration editor ?

    Yes, Days to keep historical data does what you are looking for. After the specified number of days, the old data gets overwritten with new data. So, you always have only the specified number of days' of data in Citadel.
    Note: You may sometimes see that old data doesn't get overwritten till after a day or so of your setting (depending on how much data is being logged). This is because Citadel logs in "pages" and waits till the current page it's logging to is full before it starts overwriting the old ones.
    You do not have to use the 'Max time between logs' option for this. This option forces Citadel to log data every so-many hh:mm:ss regardless of whether or not the data has changed. Note that this is NOT a way to "log data on
    demand". Because, this periodic logging of data would change for a particular tag when its data changes. So, even with this setting all data may not get logged at one shot. Anyways, as I said, you do not have to use this setting for what you're trying to do.
    Regards,
    Khalid

Maybe you are looking for

  • Express document "Update was terminated"  on saving vendor payment F-48

    TCODE F-48. When we are going to pay full payment to party it works fine Problem: When we do partiall payment for example  100 kg material  Price  $100 first time: we purchase 50kg of $50 and create GRN After this when we decide to pay the remaing pa

  • IWeb and Mountain Lion

    Hello folks, Through this community,  I learned  I can't download iWeb to install in Mountain Lion, I need to use an iLife DVD. OK, I have a MacBook running Snow Leopard and also the DVD that came with it where is iWeb, I believe into iLife. Using ex

  • Formatting current document- x2 A4 sheets into 1 A3 sheet

    Hey guys so i completed a document for a university design project where i need to create like an a4 flip book made by an a3 sheet if that makes any sense, so its just a single a3 sheet that i will print double sided (ends up being 4 A4 pages). Now t

  • Someone PLEASE post the 4S GSM unlocking procedure

    I've been on the phone for hours with global support.  Everyone says something different.  1 person said I need iTunes.  I didn't have iTunes so I hung up to download and install it.  I call back after and no one know what that person was talking abo

  • CS6 Vector Shape not visible in Layers Panel

    Anyone have any idea how to get my shape outline back? Adjusting the panel preferences has no effect. Really obnoxious bug, since obviously I can't even see my shape until I select it (and even then, it's pretty hard to find).