Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to create a procedure that adds new partition in a table partitioned by time. For this purpose I use following commands:

    s_until := to_char(sysdate+1,' SYYYY-MM-DD HH24:MI:SS');
    s_statement := 'ALTER TABLE '||s_table||' ADD PARTITION '||s_partition||' VALUES LESS THAN 
    (TO_DATE('''||s_until||''', ''SYYYY-MM-DD HH24:MI:SS'', ''NLS_CALENDAR=GREGORIAN'')) 
    TABLESPACE '||s_tablespace;
    execute immediate s_statement;

As you see I perform unnecessary conversions of date. Does anybody know how skip this dirty hack? Performing this way without conversion gives and ORA error.

    s_statement := 'ALTER TABLE '||s_table||' ADD PARTITION '||s_partition||' VALUES LESS THAN 
    (sysdate+1) TABLESPACE '||s_tablespace;
    execute immediate s_statement;
share|improve this question
up vote 1 down vote accepted

There is no way around it in Oracle 9i.

If you were using 11g, you could define the table to be interval partitioned in order to avoid having to create a new partition every day. But that's not going to help you on an ancient version of Oracle.

share|improve this answer
Thank you, for the explanation! – sev3ryn Apr 8 '13 at 11:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.