Can Partition Names be generated Dynamically

Hi All,
I have a two year worth of data in a table. As of now I have data from Jan 1st 2006 to Aug 1st 2008. I have created partitions by range based on Month and thus have more than 30 partitions on the table now(created till Dec 2008).
Next year beginning I might need to purge data for 2006 Jan-Jul/Dec. So I need not have the partitions, but need to create the partition for the new months each year in advance..... Is there a way to avoid manul intervention of creating Partitions for the following month and do it dynamically? I mean the program or query shud purge data and partition back for exactly 2 years from the current month and also create a new partition for the next month. This has to happen each month without dropping and recreating table with new partition...
Thanks,
Saff

Is there a way to avoid manul intervention of creating Partitions for the following month and do it dynamically? From 11g on you can make use of the INTERVAL Clause.

Similar Messages

  • Unable to generate partition name as per user choice

    Hi I have create one table newsales with daily partitions but partitions getting generated with system generated name like sys_162,sys_163,etc. But i want partition name to be generated in format :" p1_date" format .
    Can any one help on this?
    I tried with this but didnot work
    1 create table newsales1(id number(4),name varchar(6),order_date date)
    2 partition by range(order_date)
    3 interval(numtodsinterval(1,'DAY'))
    4 (
    5 partition 'sysdate' values less than (to_date('18-03-2013','dd-mm-yyyy'))
    6* )
    SQL> /
    partition 'sysdate' values less than (to_date('18-03-2013','dd-mm-yyyy'))
    ERROR at line 5:
    ORA-14006: invalid partition name
    Thanks for you help

    Hello,
    this is the forum for the tool {forum:id=260}. Please mark this post as answered so other users know that they can ignore it. Then post again in {forum:id=61} or {forum:id=75}.
    Regards
    Marcus

  • File name field not generating dynamic file name for report printing

    Hello Folks,
    I have a report region on a page and have enabled report printing. I would like to have the file name generated dynamically. So, I add the substitution string, say "&P1_CUSTOMER_NAME." (no quotes). The output file I get is literally named "&P1_CUSTOMER_NAME..pdf" (no quotes).
    I have seen several posts suggesting the file name field should accept this syntax but, I cannot get it to work.
    We are running Application Express 3.2.0.00.27 and BI Publisher.
    Any suggestions?
    Thanks for your help.
    -Markus B.

    I was finally able to make it work using a page process and the APEX_UTIL.DOWNLOAD_PRINT_DOCUMENT with a submit button.
    -Markus B.

  • How we can generate dynamic menu in jsp page

    Hi all,
    how we can generate dynamic menu in jsp page.
    Thanks
    Manjinder

    by reading more about them on the web or in a good book, OR BY HIRING SOMEBODY TO DO SO. ;)

  • How to identify the textbox name if they are generated dynamically

    hi
    i want to know how to identify the textbox name when they are generated dynamically. the text boxes name may vary.
    if u know tell me.
    thanx

    Try the following Code :
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    </HEAD>
    <SCRIPT language="Javascript">
    function fnShowTextBoxNames()     {
         var count = document.formHeader.elements.length;
         for(i=0;i<count;i++)     {
              var objType = document.formHeader.elements.type;
              if(objType=="text")     {
                   alert("Name Of TEXTBOX NO "+(i+1)+" --> "+document.formHeader.elements[i].name);
    </SCRIPT>
    <BODY>
    <FORM name="formHeader">
    <CENTER>
    <INPUT TYPE="TEXT" name="box1" value="" >
    <br>
    <INPUT TYPE="TEXT" name="box2" value="" >
    <br>
    <INPUT TYPE="TEXT" name="box3" value="" >
    <br>
    <INPUT TYPE="TEXT" name="box4" value="" >
    <br>
    <INPUT TYPE="TEXT" name="box5" value="" >
    <br><br>
    <input type="button" name="btn" value="Show TextBox Names" onClick="javascript:fnShowTextBoxNames();">
    </CENTER>
    <input type="hidden" name="boxCount" value="5"/>
    </FORM>
    </BODY>
    </HTML>
    Hope this suffice ur requirement !

  • How can I specify the PARTITION name at the time of data load?

    Hi,
    I have a table with 4 partitions. By using SQL*Loader I'm going to load data into the same. While inserting the records it should go to the 2nd partition only.
    Where should i specify the Partition name?
    Please clarify me with sample code.
    Thanks.

    Assuming that the partition is empty before the load, I would load the data into a temp table with the same structure as the partitioned table. After all the data is successfully loaded, exchange the partition of the table with the temp table using 'alter table ... exchange partition...'
    Another question is, how is your table partitioned?
    Message was edited by:
    Jens Petersen

  • Get table partition name dynamically for given date range

    Dear All,
    Could you please tell me how to get the partition name dynamicaly for given date range ?
    Thank you.

    SQL> select table_name,
           partition_name,
           to_date (
              trim (
                 '''' from regexp_substr (
                              extractvalue (
                                 dbms_xmlgen.
                                 getxmltype (
                                    'select high_value from all_tab_partitions where table_name='''
                                    || table_name
                                    || ''' and table_owner = '''
                                    || table_owner
                                    || ''' and partition_name = '''
                                    || partition_name
                                    || ''''),
                                 '//text()'),
              'syyyy-mm-dd hh24:mi:ss')
              high_value_in_date_format
      from all_tab_partitions
    where table_name = 'SALES' and table_owner = 'SH'
    TABLE_NAME                     PARTITION_NAME                 HIGH_VALUE_IN_DATE_FORMAT
    SALES                          SALES_1995                     01-JAN-96               
    SALES                          SALES_1996                     01-JAN-97               
    SALES                          SALES_H1_1997                  01-JUL-97               
    SALES                          SALES_H2_1997                  01-JAN-98               
    SALES                          SALES_Q1_1998                  01-APR-98               
    SALES                          SALES_Q2_1998                  01-JUL-98               
    SALES                          SALES_Q3_1998                  01-OKT-98               
    SALES                          SALES_Q4_1998                  01-JAN-99               
    SALES                          SALES_Q1_1999                  01-APR-99               
    SALES                          SALES_Q2_1999                  01-JUL-99               
    SALES                          SALES_Q3_1999                  01-OKT-99               
    SALES                          SALES_Q4_1999                  01-JAN-00               
    SALES                          SALES_Q1_2000                  01-APR-00               
    SALES                          SALES_Q2_2000                  01-JUL-00               
    SALES                          SALES_Q3_2000                  01-OKT-00               
    SALES                          SALES_Q4_2000                  01-JAN-01               
    SALES                          SALES_Q1_2001                  01-APR-01               
    SALES                          SALES_Q2_2001                  01-JUL-01               
    SALES                          SALES_Q3_2001                  01-OKT-01               
    SALES                          SALES_Q4_2001                  01-JAN-02               
    SALES                          SALES_Q1_2002                  01-APR-02               
    SALES                          SALES_Q2_2002                  01-JUL-02               
    SALES                          SALES_Q3_2002                  01-OKT-02               
    SALES                          SALES_Q4_2002                  01-JAN-03               
    SALES                          SALES_Q1_2003                  01-APR-03               
    SALES                          SALES_Q2_2003                  01-JUL-03               
    SALES                          SALES_Q3_2003                  01-OKT-03               
    SALES                          SALES_Q4_2003                  01-JAN-04               
    28 rows selected.

  • Call Data in Variable in Stored Procedure for Partition Name

    Hi,
    Here is an excerpt from a Srored Proc I have written.
    The aim here is to copy data from a partition of a table.
    I first query the partition-name from the ALL_TAB_PARTITIONS table and store the same in a VARCHAR2 variable named partition_name_low.
    I then try to select the data in this partition of the table by using the variable name.
    PROCEDURE purging AS
    partition_name_low VARCHAR2(25);
    BEGIN
    --+
    -- Query for the Highest Value of the timestamp in the 1st partition in current table.
    --+
    SELECT PARTITION_NAME
    INTO partition_name_low
    FROM ALL_TAB_PARTITIONS
    WHERE TABLE_NAME = 'TABLE1' AND PARTITION_POSITION IN
    +(+
    SELECT MIN(PARTITION_POSITION)
    FROM ALL_TAB_PARTITIONS
    WHERE TABLE_NAME = 'TABLE1'
    +);+
    COMMIT;
    COMMIT;
    DBMS_OUTPUT.PUT_LINE(partition_name_low ||' **********  ' || TO_char(sysdate, 'MM/DD/YYYY HH24:MI:SS')||' Starting Purging Data  *********');
    --+
    -- Copy data from 1st partition to Archive Table
    --+
    INSERT /* APPEND */ INTO TABLE1_ARCHIVE+
    SELECT * FROM TABLE1 PARTITION(partition_name_low);
    However, I am facing an issue here since I keep on gettin an error that "ORA-02149: Specified Partition does not exist".
    What I understand is that the Oracle query is picking up the literal string "partition_name_low", instead of the data inside it.
    I tried with
    &partition_name_low
    AND
    :partition_name_low
    with no luck.
    For the 2nd case I get the obvious exception "bad bind variable".
    Can someone please suggest in which way I can handle this situation where I can use a variable refer the partition name in a select query?
    Thanks in advance!!
    Abhishek.

    Hi,
    You have to use "execute immediate" to launch dynamic SQL command.
    So you should write
    execute immediate 'INSERT /* APPEND */ INTO TABLE1_ARCHIVE+
    SELECT * FROM TABLE1 PARTITION('||partition_name_low||')' ;
    Mike

  • Default partition name for Interval partitioned tables

    Hi ,
    Can we change the default partition names which are generated by Oracle.
    For Example :
    CREATE TABLE part_interval (
    id NUMBER,
    created_date DATE
    PARTITION BY RANGE (created_date)
    INTERVAL (NUMTOYMINTERVAL(1,'MONTH'))
    PARTITION part_01 values LESS THAN (TO_DATE('01-NOV-2007','DD-MON-YYYY'))
    Now if I insert values which doesn't fall in the 01-NOV-2007 date, a new partition is created like SYS_P43. Can I change this default partition name in the SQL statement itself . Not through procedures or functions.
    Regards,
    Raghunathan A
    Edited by: 869187 on Jun 29, 2011 6:08 AM

    869187 wrote:
    Hi ,
    Can we change the default partition names which are generated by Oracle. post SQL & results that show you can change partition names generated by YOU.

  • Partition name selection

    hi
    i have a table tab1 with 10 partitions, and partition key being year , and partition names goes like year0304, year0405 and so on....
    can i use SELECT STATEMENT in which the keyword PARTITION(PARTITION_NAME) be substituted dynamically , by intializing it to some variable like
    part := 'PARTITION('||PART_YEAR||')';
    where PART_YEAR is a variable which gets value through some function as year0304, year0405.....
    And ultimately using it as
    sql> select * from tab1 part where x =something;
    i did tried but the query is treating the PART as some table alias.
    any suggestions, pls help me
    regards
    srinivas

    If the object is analyzed and predicate demands it, Oracle will automatically use the required partition.
    In the example below Oracle automatically uses the correct partition based on the predicate (look at Pstart and Pstop columns):
    SQL> create table part(
      2   part_key varchar2(10))
      3  partition by range
      4  (part_key)
      5  (partition part_#1 values less than ('C'),
      6   partition part_#2 values less than ('H'),
      7   partition part_#3 values less than ('Z'),
      8   partition part_#4 values less than (MAXVALUE)
      9  )
    10  /
    Table created.
    SQL> BEGIN
      2      FOR idx IN ascii('A') .. ascii('Z')
      3      LOOP
      4          INSERT INTO part VALUES (chr(idx));
      5      END LOOP;
      6  END;
      7  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> analyze table part compute statistics for table for all indexes for all indexed columns ;
    Table analyzed.
    SQL>
    SQL> explain plan for select * from part where part_key = 'G' ;
    Explained.
    SQL> @?\rdbms\admin\utlxpls
    PLAN_TABLE_OUTPUT
    | Id  | Operation            |  Name       | Rows  | Bytes | Cost  | Pstart| Pstop |
    |   0 | SELECT STATEMENT     |             |     1 |     5 |     2 |       |       |
    |*  1 |  TABLE ACCESS FULL   | PART        |     1 |     5 |     2 |     2 |     2 |
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
       1 - filter("PART"."PART_KEY"='G')
    Note: cpu costing is off
    14 rows selected.
    SQL>

  • Generating Dynamic IDs

    Hello All,
    I need to generate dynamic ids on the <h:commandLink.
    However if i put something like
    <h:dataTable id="items" value="#{FormBean.resultList}" var="listItem" >
      <h:commandLink id="#{listItem.recordId}" action="some.page" actionListener="#{someFormBean.someMethod}">
      </h:commandLink>
    </h:dataTable>it throws
    java.lang.IllegalArgumentException: #{listItem.recordId}
            at javax.faces.component.UIComponentBase.validateId(UIComponentBase.java:454)Basically, i need to generate a list of results and each row in the list should have a hyperlink which will open the row details. I was hoping to get the rowid in the actionListener method by using event.getComponent().getId().
    Any help is appreciated
    Thanks

    Thanks for the reply. I tried doing that and couldn't get it to work. I looked at the requestMap and it shows something like the following
    subview1:subview2:_id15:_idcl=subview1:subview2:_id15:items:0:_id18
    So it does have the correct row number and items is the "id" of the datatable, however how do i get that row number using the "var" name as you suggested ?
    Moreever the component which maintains the row number --> record id mapping may be different from the component which handles the event. So i may have to add some extra logic in the event handling component to retreive the recordid, based on the row number.
    Another alternative which worked fine , was to include a param tag (containing the recordid) inside the command tag. So the event handling component can retrieve that param directly without relying on any other component. I am not sure if this is the recommended way.

  • Partition Name in Select and Group-By

    Is there a function that returns the partition name a row is stored in? I'd like to use it in a SELECT statement, if it exists.
    The goal is to get row counts per partition to determine skew on a hash-based partition (otherwise, I'd just select and group-by the partition key). I want to do something like this:
    SELECT PARTITION_NAME, COUNT(*) as PER_PART_COUNT
      FROM SOMETABLE
    GROUP BY PARTITION_NAME;Obviously, I would replace the string "*PARTITION_NAME*" with whatever function returns that value.
    NOTE: Before the forum sharks jump all over me, I did search the documentation and forums, but I came up empty handed.

    Hi,
    This is hokey - but you can use the undocumented function "tbl$or$idx$part$num" like so:
    SELECT   atp.partition_name
           , COUNT (*) AS count_rows
        FROM all_tab_partitions atp
           , (SELECT tbl$or$idx$part$num ("SCOTT"."TAB1"
                                        , 0
                                        , 1
                                        , 0
                                        , partition_col1 -- your 1st partition key column
                                        , partition_col2 -- your 2nd partition key column
                                         ) AS part_num
                   , 'TAB1' AS table_name
                   , 'SCOTT' AS owner
                FROM scott.tab1) pt
       WHERE atp.table_name = pt.table_name
         AND atp.table_owner = pt.owner
         AND atp.partition_position = pt.part_num
    GROUP BY atp.partition_name;Note - this probably won't perform well at all... but it could be an option...
    Message was edited by:
    PDaddy
    ... On 2nd thought - don't do it - it seems it is pretty unstable - brought my session to a halt a couple of times... Forget I mentioned it :)
    ... On 3rd thought - if you add ROWNUM - it works fine - seems you need to materialize the result set in the inner query - like so:
    CREATE TABLE part_tab (part_key int
                         , a int
    partition by range (part_key)
    (partition p1 values less than (100)
    ,partition p2 values less than (200)
    ,partition p3 values less than (maxvalue)
    insert into part_tab
    select rownum
         , rownum
    FROM all_objects
    where rownum <= 1000; SELECT atp.partition_name
         , COUNT(*) AS count_rows
    FROM all_tab_partitions atp
       , (SELECT TBL$OR$IDX$PART$NUM("PART_TAB", 0, 1, 0, part_key) AS part_num
               , 'PART_TAB' AS table_name
               , user AS owner
               , ROWNUM AS rn -- Materialize the result set by adding ROWNUM...
          FROM part_tab) pt
    WHERE atp.table_name = pt.table_name
      AND atp.table_owner = pt.owner
      AND atp.partition_position = pt.part_num
    GROUP BY atp.partition_name;

  • CHART BUILDER ERROR WHEN TRYING TO GENERATE DYNAMIC CHARTS ON A JSP PAGE

    I'm working with J Develop 9.03 on Windows 2000 Professional Edition.
    I'm using the JSP demo files provided with Oracle Chart Builder to generate
    dynamic charts. The user specifies the query parameters, including the date
    range and the query results are returned by means of a line chart (with date on
    the x axis and values on the y axis).
    When trying to compile the project I get the following error messages:
    Error(165,2): class FileOutputStream not found in class _graph
    Error(170,5): class File not found in class _graph
    Error(176,4): exception java.io.IOException is never thrown in the
    corresponding try block
    I checked to see that the chartbuilder library (chartbuilder.jar) files are
    loaded into the project library. It's unusual that the class is not being
    found. I don't understand why. I developed my project using the following steps:
    1. Unzipped Chart Builder installation files into c:\Oraclechartbuilder
    2. Loaded chartbuilder class library
    c:\Oraclechartbuilder\chartbuilder\lib\chartbuilder.jar into J Developer class
    path (by selecting <Project Settings> <Paths> and browsing to the
    chartbuilder.jar file).
    3. Created a new JSP page in J Developer (graph.jsp)
    4. Copied JSP code syntax from the Word Pad demo file and pasted into graph.jsp
    5. Changed the DB connection parameters and static directory location on the
    JSP page.
    6. Compiled the project and received the above errors.
    I would like to know why the classes are not being found and how to fix the problem. Thanks, Jaafar

    Hi mshah101,
    This can happen if the applet is compiled using an higher version of java and the browser is pointing to an older version (even if minor version number is higher)

  • How to pass tag name and value dynamically in the output of PCo notification?

    Hi,
    I have a requirement to develop such a scenario where there can be multiple no of tags in PCo (Say 10) but there will be single notification to push the tag name when the value got changed and the changed value to MII. for any value change for any of the tag, the notification will be trigger. So As per my knowledge I have to pass the tag name and value dynamically in the "output" tab of the notification. But need your support to find out how to pass them dynamically.
    Thanks in advance.
    Regards,
    Suman

    Hi Suman/Jeedesh,
    As per Pco notification, it will trigger whenever any of the tag value changes in Agent instance subscription items.
    For above issue, My suggestion
    1. Create DB table name TAGLIST with 200 tags as rows in columns (Tagname, TagValue)
    2. Based on notification trigger, create a transaction and update values w.r.t TagNames in above table
    3. Next time, when notification trigger with fresh value for any of the tag, cross check with existing TagName with Value and update in DB table.
    4. And in the mean time, send those Tag details vie mail trigger or as per requirement
    Instead of creating 200 notification, above is a just alternate way suggestion to achieve dynamic tag value change notification.
    Hope it might solve your problem
    Regards,
    Praveen Reddy

  • Unable to generate Dynamic PDF

    Hi,
    I created a xdp file from xml and xsl files and then used Form Server to generate dynamic pdf file. The xdp file has lot of javascript. The pdf file generated by form server does not change colors of labels of the fields, when incorrect values are entered into the fields (accomplished using javascript). But the xdp file used to generate this pdf when run within Adobe Form Designer shows changes of colors of labels. I observed few differences between the two approaches. One being dynamicRenderer tag. How can I accomplish the changes of colors in the pdf generated using form server?
    Thanks a lot in advance

    To force the generated PDF to be a dynamic PDF add the following option to the option string passed into the renderForm() method:
    RenderAtClient=true
    Chris
    Adobe Enterprise Developer Support

Maybe you are looking for