0

I would like to create a partition table in Oracle SQL DEVELOPER, using two columns with different types? I want to stock in the partition table all data where:

creation_date <'2021' and task_status='done'

But I did not find a way on how to create it because I need to choose only one column to create a partition table, Or in the case of partition with multiple columns , the columns must have the same datatype.

Any help would be appreciated!

Wernfried Domscheit
3,3911 gold badge17 silver badges16 bronze badges
asked Jan 24, 2024 at 23:36

1 Answer 1

1

You can create subpartitions, for example like this:

CREATE TABLE ...
(
 creation_date TIMESTAMP(0) NOT NULL,
 task_status VARCHAR2(20 CHAR) NOT NULL,
 ...
)
PARTITION BY RANGE (creation_date)
INTERVAL (INTERVAL '1' MONTH)
SUBPARTITION BY LIST (task_status)
SUBPARTITION TEMPLATE (
 SUBPARTITION P_DONE VALUES ('done'),
 SUBPARTITION P_PENDING VALUES ('pending','waiting'),
 SUBPARTITION P_OTHERS VALUES (DEFAULT)
)
(
 PARTITION P_INITIAL VALUES LESS THAN (TIMESTAMP '2024-01-01 00:00:00') 
)
ENABLE ROW MOVEMENT;

Monthly partitions will be created automatically when you insert any data.

answered Jan 25, 2024 at 12:16

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.