首先创建空表
分区结构如下:c_year为主分区 c_process_id为子分区
create table TB_CNB_PAY_RECORD_2
(
c_oid VARCHAR2(36) not null,
c_process_id VARCHAR2(36) not null,
c_employee_id VARCHAR2(36) not null,
c_emp_code VARCHAR2(64),
c_emp_name VARCHAR2(256),
c_company_id VARCHAR2(36),
c_company_name VARCHAR2(256),
c_dept_id VARCHAR2(36),
c_dept_name VARCHAR2(256),
c_job_id VARCHAR2(36),
c_job_name VARCHAR2(256),
c_position_id VARCHAR2(36),
c_position_name VARCHAR2(256),
c_item_id VARCHAR2(36) not null,
c_item_name VARCHAR2(256),
c_value NUMBER(16,6) not null,
c_operator VARCHAR2(36) not null,
c_operate_time TIMESTAMP(6) not null,
c_begin_date DATE,
c_end_date DATE,
c_actual_pay_date DATE,
c_period VARCHAR2(36),
c_pay_slip_id VARCHAR2(32),
c_year NUMBER,
c_month NUMBER,
c_payroll_unit VARCHAR2(256),
c_account_unit VARCHAR2(256),
c_location VARCHAR2(64)
)
partition by range(c_year) interval(1)
subpartition by hash(c_process_id)
subpartition template
(
subpartition sub1 tablespace talentbase,
subpartition sub2 tablespace talentbase,
subpartition sub3 tablespace talentbase,
subpartition sub4 tablespace talentbase,
subpartition sub5 tablespace talentbase,
subpartition sub6 tablespace talentbase,
subpartition sub7 tablespace talentbase,
subpartition sub8 tablespace talentbase,
subpartition sub9 tablespace talentbase,
subpartition sub10 tablespace talentbase,
subpartition sub11 tablespace talentbase,
subpartition sub12 tablespace talentbase,
subpartition sub13 tablespace talentbase,
subpartition sub14 tablespace talentbase,
subpartition sub15 tablespace talentbase,
subpartition sub16 tablespace talentbase,
subpartition sub17 tablespace talentbase,
subpartition sub18 tablespace talentbase,
subpartition sub19 tablespace talentbase,
subpartition sub20 tablespace talentbase,
subpartition sub21 tablespace talentbase,
subpartition sub22 tablespace talentbase,
subpartition sub23 tablespace talentbase,
subpartition sub24 tablespace talentbase,
subpartition sub25 tablespace talentbase,
subpartition sub26 tablespace talentbase,
subpartition sub27 tablespace talentbase,
subpartition sub28 tablespace talentbase,
subpartition sub29 tablespace talentbase,
subpartition sub30 tablespace talentbase,
subpartition sub31 tablespace talentbase,
subpartition sub32 tablespace talentbase,
subpartition sub33 tablespace talentbase,
subpartition sub34 tablespace talentbase,
subpartition sub35 tablespace talentbase,
subpartition sub36 tablespace talentbase,
subpartition sub37 tablespace talentbase,
subpartition sub38 tablespace talentbase,
subpartition sub39 tablespace talentbase,
subpartition sub40 tablespace talentbase,
subpartition sub41 tablespace talentbase,
subpartition sub42 tablespace talentbase,
subpartition sub43 tablespace talentbase,
subpartition sub44 tablespace talentbase,
subpartition sub45 tablespace talentbase,
subpartition sub46 tablespace talentbase,
subpartition sub47 tablespace talentbase,
subpartition sub48 tablespace talentbase,
subpartition sub49 tablespace talentbase,
subpartition sub50 tablespace talentbase,
subpartition sub51 tablespace talentbase,
subpartition sub52 tablespace talentbase,
subpartition sub53 tablespace talentbase,
subpartition sub54 tablespace talentbase,
subpartition sub55 tablespace talentbase,
subpartition sub56 tablespace talentbase,
subpartition sub57 tablespace talentbase,
subpartition sub58 tablespace talentbase,
subpartition sub59 tablespace talentbase,
subpartition sub60 tablespace talentbase,
subpartition sub61 tablespace talentbase,
subpartition sub62 tablespace talentbase,
subpartition sub63 tablespace talentbase,
subpartition sub64 tablespace talentbase,
subpartition sub65 tablespace talentbase,
subpartition sub66 tablespace talentbase,
subpartition sub67 tablespace talentbase,
subpartition sub68 tablespace talentbase,
subpartition sub69 tablespace talentbase,
subpartition sub70 tablespace talentbase,
subpartition sub71 tablespace talentbase,
subpartition sub72 tablespace talentbase,
subpartition sub73 tablespace talentbase,
subpartition sub74 tablespace talentbase,
subpartition sub75 tablespace talentbase,
subpartition sub76 tablespace talentbase,
subpartition sub77 tablespace talentbase,
subpartition sub78 tablespace talentbase,
subpartition sub79 tablespace talentbase,
subpartition sub80 tablespace talentbase,
subpartition sub81 tablespace talentbase,
subpartition sub82 tablespace talentbase,
subpartition sub83 tablespace talentbase,
subpartition sub84 tablespace talentbase,
subpartition sub85 tablespace talentbase,
subpartition sub86 tablespace talentbase,
subpartition sub87 tablespace talentbase,
subpartition sub88 tablespace talentbase,
subparti