Database Reference
In-Depth Information
7 enable row movement
8 PARTITION BY RANGE (order_date)
9 (
10 PARTITION part_2014 VALUES LESS THAN (to_date('01-01-2015','dd-mm-yyyy')) ,
11 PARTITION part_2015 VALUES LESS THAN (to_date('01-01-2016','dd-mm-yyyy'))
12 )
13 /
Table created.
EODA@ORA12CR1> insert into orders values
2 ( 1, to_date( '01-jun-2014', 'dd-mon-yyyy' ), 'xxx' );
1 row created.
EODA@ORA12CR1> insert into orders values
2 ( 2, to_date( '01-jun-2015', 'dd-mon-yyyy' ), 'xxx' );
1 row created.
And now we'll create the ORDER_LINE_ITEMS table - with a bit of data pointing to the ORDERS table:
EODA@ORA12CR1> create table order_line_items
2 (
3 order# number,
4 line# number,
5 order_date date, -- manually copied from ORDERS!
6 data varchar2(30),
7 constraint c1_pk primary key(order#,line#),
8 constraint c1_fk_p foreign key(order#) references orders
9 )
10 enable row movement
11 PARTITION BY RANGE (order_date)
12 (
13 PARTITION part_2014 VALUES LESS THAN (to_date('01-01-2015','dd-mm-yyyy')) ,
14 PARTITION part_2015 VALUES LESS THAN (to_date('01-01-2016','dd-mm-yyyy'))
15 )
16 /
Table created.
EODA@ORA12CR1> insert into order_line_items values
2 ( 1, 1, to_date( '01-jun-2014', 'dd-mon-yyyy' ), 'yyy' );
1 row created.
EODA@ORA12CR1> insert into order_line_items values
2 ( 2, 1, to_date( '01-jun-2015', 'dd-mon-yyyy' ), 'yyy' );
1 row created.
 
Search WWH ::




Custom Search