All Products
Search
Document Center

ApsaraDB for OceanBase:Subpartition templates

Last Updated:Nov 28, 2024

This topic describes the conversion scope of CREATE TABLE DDL operations for defining subpartition templates during data migration from an Oracle database to an Oracle tenant of OceanBase Database.

Syntax of subpartition_template:

SUBPARTITION TEMPLATE
  ( { range_subpartition_desc [, range_subpartition_desc] ...
    | list_subpartition_desc [, list_subpartition_desc] ...
    | individual_hash_subparts [, individual_hash_subparts] ...
    }
  ) | hash_subpartition_quantity

Defining subpartition templates by using the SUBPARTITION TEMPLATE keywords are supported. The syntax in the template is the same as that of user-defined partitions. For more information, see User-defined partitions. Sample code:

CREATE TABLE 
T (C1 DATE, C2 NUMBER)PARTITION BY RANGE (C1) SUBPARTITION BY RANGE (C2)
SUBPARTITION TEMPLATE 
(SUBPARTITION SP_TEMP VALUES LESS THAN (999))
(
  PARTITION SALES_Q1_1998 VALUES LESS THAN (TO_DATE('01-APR-1998','DD-MON-YYYY', 'NLS_DATE_LANGUAGE=AMERICAN')),
  PARTITION SALES_Q3_1999 VALUES LESS THAN (TO_DATE('01-OCT-1999','DD-MON-YYYY', 'NLS_DATE_LANGUAGE=AMERICAN')),
  PARTITION SALES_Q2_2000 VALUES LESS THAN (TO_DATE('01-JUL-2000','DD-MON-YYYY', 'NLS_DATE_LANGUAGE=AMERICAN')),
  PARTITION SALES_Q3_2000 VALUES LESS THAN (TO_DATE('01-OCT-2000','DD-MON-YYYY', 'NLS_DATE_LANGUAGE=AMERICAN')),
  PARTITION SALES_Q4_2000 VALUES LESS THAN (MAXVALUE)
  );