Take the 2-minute tour ×
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. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.