I am trying to create an index cluster in Oracle SQL, but when I try to create the index for it, I get the following error:
ORA-02158: invalid CREATE INDEX option
02158. 00000 - "invalid CREATE INDEX option"
*Cause: An option other than COMPRESS, NOCOMPRESS, PCTFREE, INITRANS,
MAXTRANS, STORAGE, TABLESPACE, PARALLEL, NOPARALLEL, RECOVERABLE,
UNRECOVERABLE, LOGGING, NOLOGGING, LOCAL, or GLOBAL was specified.
*Action: Choose one of the valid CREATE INDEX options.
And this is the code I'm trying to execute
CREATE CLUSTER index_cluster_t1_col1 (col1 INTEGER) INDEX;
CREATE INDEX index_cluster_index ON CLUSTER index_cluster_t1_col1(col1);
The first line works fine, but the error comes up when I try to execute the second one. I've been following the official docs and not sure what part of the syntax I'm missing. The index options parameters seem to be optional.
Try this:
CREATE INDEX index_cluster_index ON CLUSTER index_cluster_t1_col1;
You've already defined which columns are in the cluster; you don't need to repeat that information in the create index
command. Just name the cluster.