Swadhin Ray
asked on
Adding multiple partition to a oracle table
Hello Experts,
I need an urgent help on adding partition to a table.
Here is my code:
But I get the error by for two partition cannot be done , so what would be the best solution to get the range partition on two columns ?
I need an urgent help on adding partition to a table.
Here is my code:
CREATE TABLE TEST
(
COL1 VARCHAR2(10),
COL2 VARCHAR2(32) GENERATED ALWAYS AS (SUBSTR(TRIM(TIMESTAMP), 1, 8)) VIRTUAL NOT NULL,
col3 VARCHAR2(32) GENERATED ALWAYS AS (SUBSTR(TRIM(TIMESTAMP), 1, 6)) VIRTUAL NOT NULL
)
PARTITION BY RANGE(COL2)(PARTITION P20120822 VALUES LESS THAN (20120823)),
PARTITION BY RANGE(col3)(PARTITION P201206 VALUES LESS THAN (20120823)),
;
But I get the error by for two partition cannot be done , so what would be the best solution to get the range partition on two columns ?
ASKER
can we do a sub partition on the range for two different columns ?
You partition on one range for col2 then you should be able to subpartition by col3 or col3 then col2.
Check out:
Composite Partitioned Table - By Range And Range
http://psoug.org/reference/partitions.html
Check out:
Composite Partitioned Table - By Range And Range
http://psoug.org/reference/partitions.html
ASKER
I am getting syntax error for the below code .
I am doing something really wrong on this:
I am doing something really wrong on this:
CREATE TABLE TEST_T
(
COL1 VARCHAR2(10),
COL2 VARCHAR2(32) GENERATED ALWAYS AS (SUBSTR(TRIM(TIMESTAMP), 1, 8)) VIRTUAL NOT NULL,
col3 VARCHAR2(32) GENERATED ALWAYS AS (SUBSTR(TRIM(TIMESTAMP), 1, 6)) VIRTUAL NOT NULL
)
PARTITION BY RANGE
(
COL2
)
SUBPARTITION BY RANGE
(
COL3
)
SUBPARTITION TEMPLATE
(
SUBPARTITION P201206 VALUES LESS THAN (20120823)
)
PARTITION P20120822 VALUES LESS THAN
(
20120823
) ;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You might need to use sub-partitions on the second value if you need that many partitions.
http://ora-14027.ora-code.com/