Reputation: 193
I want to create this table, with a monthly partition on the endTime column. I mean each month a partition added automatically by oracle.
create table T_CALLSESSION() PARTITON BY RANGE (C_ENDTIME )
INTERVAL(NUMTOYMINTERVAL(1,'month'); (
C_ID NUMBER(34, 0) not null,
C_ENDTIME timestamp not null,
C_STARTTIME timestamp not null,
C_TYPE number(10,0) not null,
F_CREATOR NUMBER(34, 0),
F_MESSAGE_THREAD NUMBER(34, 0),
primary key (C_ID)
);
is that works?
Upvotes: 0
Views: 286
Reputation: 35900
There are a few mistakes in your code.
()
PARTITION
clause must be after the declaration of columns and constraints.INTERVAL
partition so that new partitions are automatically created.Use the following code:
create table T_CALLSESSION (
C_ID NUMBER(34, 0) not null,
C_ENDTIME timestamp not null,
C_STARTTIME timestamp not null,
C_TYPE number(10,0) not null,
F_CREATOR NUMBER(34, 0),
F_MESSAGE_THREAD NUMBER(34, 0),
primary key (C_ID)
) PARTITION BY RANGE (C_ENDTIME)
INTERVAL(NUMTOYMINTERVAL(1, 'MONTH'))
(
PARTITION T_CALLSESSION_P1 VALUES LESS THAN (TO_DATE('01-06-2020', 'DD-MM-YYYY'))
);
Upvotes: 1