-- Create table
create table T_REPORT_DAILYSALES
(
ORDERDATE DATE not null,
BRANCHFLAG CHAR(3) not null,
PRODID CHAR(11) not null,
QUANTITY NUMBER(15,2),
AMOUNT NUMBER(15,2)
)
partition by range (ORDERDATE)
(
partition Daysales2009_01 values less than (TO_DATE(' 2009-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
tablespace RPTFACT2009
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 10M
minextents 1
maxextents unlimited
),
partition Daysales2009_02 values less than (TO_DATE(' 2009-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
tablespace RPTFACT2009
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 10M
minextents 1
maxextents unlimited
),
partition Daysales2009_03 values less than (TO_DATE(' 2009-03-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
tablespace RPTFACT2009
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 10M
minextents 1
maxextents unlimited
),
partition Daysales2009_04 values less than (TO_DATE(' 2009-04-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
tablespace RPTFACT2009
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 10M
minextents 1
maxextents unlimited
),
partition Daysales2009_05 values less than (TO_DATE(' 2009-05-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
tablespace RPTFACT2009
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 10M
minextents 1
maxextents unlimited
),
partition Daysales2009_06 values less than (TO_DATE(' 2009-06-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
tablespace RPTFACT2009
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 10M
minextents 1
maxextents unlimited
),
partition Daysales2009_07 values less than (TO_DATE(' 2009-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
tablespace RPTFACT2009
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 10M
minextents 1
maxextents unlimited
),
partition Daysales2009_08 values less than (TO_DATE(' 2009-08-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
tablespace RPTFACT2009
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 10M
minextents 1
maxextents unlimited
),
partition Daysales2009_09 values less than (TO_DATE(' 2009-09-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
tablespace RPTFACT2009
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 10M
minextents 1
maxextents unlimited
),
partition Daysales2009_10 values less than (TO_DATE(' 2009-10-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
tablespace RPTFACT2009
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 10M
minextents 1
maxextents unlimited
),
partition Daysales2009_11 values less than (TO_DATE(' 2009-11-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
tablespace RPTFACT2009
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 10M
minextents 1
maxextents unlimited
),
partition Daysales2009_12 values less than (TO_DATE(' 2009-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
tablespace RPTFACT2009
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 10M
minextents 1
maxextents unlimited
)
)
;
comment on table T_REPORT_DAILYSALES
is '商品日均销量(31天)';
-- Add comments to the columns
comment on column T_REPORT_DAILYSALES.ORDERDATE
is '日期';
comment on column T_REPORT_DAILYSALES.BRANCHFLAG
is '分公司标识';
comment on column T_REPORT_DAILYSALES.PRODID
is '商品内码';
comment on column T_REPORT_DAILYSALES.QUANTITY
is '数量';
comment on column T_REPORT_DAILYSALES.AMOUNT
is '金额';
-- Create/Recreate indexes
alter table T_REPORT_DAILYSALES
add primary key (ORDERDATE, BRANCHFLAG, PRODID)
using index
tablespace RPTINDEX
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 5M
minextents 1
maxextents unlimited
);