|
Partition by range DDL generator |
|
|
|
|
Written by Martin
|
|
Tuesday, 08 June 2010 |
|
It's quite tedious to manually compose a range of dates for partitioning, especially for testing purposes. So I wrote a little bit of code to make this easier: declare v_date date; begin for i in 1..20 loop v_date := to_date('01.01.2009','dd.mm.yyyy') + numtoyminterval(i,'MONTH'); dbms_output.put_line('partition p'||rpad(to_char(i), 2)||' values less than (to_date('''|| to_char(v_date,'dd.mm.yyyy')|| ''', ''dd.mm.yyyy'')),'); end loop; dbms_output.put_line('partition pmax values less than (maxvalue)'); end; /
To make this work for you, do the following: - change v_date to your start date (here: 01.01.2009)
- set serveroutput on
- copy and paste!
|
|
Last Updated ( Tuesday, 08 June 2010 )
|