Hi Guy's,
Today we will see how to create partitions in oracle by giving storage parameters.
SQL> CREATE TABLE SHEET_TAB_PART
(
SDHSCD VARCHAR2(2) NOT NULL,
SDSHID VARCHAR2(20) NOT NULL,
SDMEDN NUMBER(16) NOT NULL,
SDCASN NUMBER(16) NOT NULL,
SDSEQN NUMBER(16) NOT NULL,
SDFDNM VARCHAR2(20) NOT NULL,
SDDTAN NUMBER(16) NOT NULL,
SDFLDT VARCHAR2(4000),
SDORDN NUMBER(15),
SDITEM VARCHAR2(10),
SDDATE VARCHAR2(12),
SDOCUR FLOAT(126) NOT NULL,
SDMDDT DATE,
SDSHNM VARCHAR2(15),
SDTYPE VARCHAR2(5),
COLOR VARCHAR2(3),
SDRTE VARCHAR2(2),
LABNUM NUMBER(8),
SDNRMMIN NUMBER(15,5),
SDNRMMAX NUMBER(15,5),
SDNRMUNIT VARCHAR2(20),
SDUSER VARCHAR2(50),
SDTIME VARCHAR2(6),
ORDER_NO NUMBER,
SDPNCMAX NUMBER(10,5),
SDPNCMIN NUMBER(10,5))
PARTITION BY RANGE (SDMDDT)
(
PARTITION SH_P2011 VALUES LESS THAN (TO_DATE ('01-JAN-2011','DD-MON-YYYY')) tablespace tspart,
PARTITION SH_P2012 VALUES LESS THAN (TO_DATE ('01-JAN-2012','DD-MON-YYYY')) tablespace tspart,
PARTITION SH_P2013 VALUES LESS THAN (TO_DATE ('01-JAN-2013','DD-MON-YYYY')) tablespace tspart,
PARTITION SH_P2014 VALUES LESS THAN (TO_DATE ('01-JAN-2014','DD-MON-YYYY')) tablespace tspart,
PARTITION SH_P2015 VALUES LESS THAN (TO_DATE ('01-JAN-2015','DD-MON-YYYY')) tablespace tspart,
PARTITION SH_P2016 VALUES LESS THAN (TO_DATE ('01-JAN-2016','DD-MON-YYYY')) tablespace tspart,
PARTITION SH_P2017 VALUES LESS THAN (TO_DATE ('01-JAN-2017','DD-MON-YYYY')) tablespace tspart,
PARTITION SH_P2018 VALUES LESS THAN (TO_DATE ('01-JAN-2018','DD-MON-YYYY')) tablespace tspart,
PARTITION SH_P2019 VALUES LESS THAN (TO_DATE ('01-JAN-2019','DD-MON-YYYY')) tablespace tspart,
PARTITION SH_P2020 VALUES LESS THAN (TO_DATE ('01-JAN-2020','DD-MON-YYYY')) tablespace tspart,
PARTITION SH_P2021 VALUES LESS THAN (TO_DATE ('01-JAN-2021','DD-MON-YYYY')) tablespace tspart,
PARTITION SH_P2022 VALUES LESS THAN (TO_DATE ('01-JAN-2022','DD-MON-YYYY')) tablespace tspart,
PARTITION SH_PMAX VALUES LESS THAN (MAXVALUE) tablespace tspart
PCTUSED 40
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 15728640
NEXT 1048576
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
MAXSIZE UNLIMITED
BUFFER_POOL DEFAULT
FLASH_CACHE DEFAULT
CELL_FLASH_CACHE DEFAULT
)
LOGGING
NOCOMPRESS);
Table created.
Happy Learning...
No comments:
Post a Comment