Table of Contents

Oracle Partition - Partitioning key(s)

About

The partitioning key(s) is an ordered list of columns.

Restrictions

The list columns must contain only columns (no expression). If you want to use a function in the partition key, you need to create a virtual_column.

Example

Virtual Column

Oracle Database - Virtual Column

In this configuration, it's not possible to create directly a Range Interval Partitioning because the key column must be a number or a date. Therefore we create a virtual column transforming the character to a number.

create table EXAMPLE (
       D_TIME_CODE        VARCHAR2(10 CHAR),
       D_TIME_CODE_V    NUMBER GENERATED ALWAYS AS (  substr(D_TIME_CODE,3) ) VIRTUAL
   ) 
  PARTITION BY RANGE (D_TIME_CODE_V) 
  INTERVAL(1)
 (
    PARTITION p1 VALUES LESS THAN ( 201014 )
  )