Home > Blockchain >  Oracle12c - Can't create a table with partitioning "ORA-00922: missing or invalid option&q
Oracle12c - Can't create a table with partitioning "ORA-00922: missing or invalid option&q

Time:11-16

I am trying to create a table with partitions but, I constantly get the same error. The exact oracle version is 12.1.0.2.0

create table toys (
  name varchar2(10),
  weight number,
  color varchar2(10),
  PRIMARY KEY (name)
)
partition by list (color) partitions (
  partition p_green values ('green'),
  partition p_red values ('red')
);

Is there some other prerequisite that must be done before I can created a partitioned table ?

CodePudding user response:

VALUES keyword is required:

create table toys (
  name varchar2(10),
  weight number,
  color varchar2(10),
  PRIMARY KEY (name)
)
partition by list (color) -- partitions  -- removed
                          -- automatic
(
  partition p_green VALUES('green'),
  partition p_red VALUES('red')
  --,partition p_def VALUES(DEFAULT)
);

db<>fiddle demo

  • Related