The documentation of Oracle 23c's ALTER INDEX
statement claims that IF EXISTS
is a valid clause:
https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/ALTER-INDEX.html
But it doesn't work:
create table t (i int);
create index i on t (i);
alter index if exists i rename to j;
Leading to:
ORA-11557: IF EXISTS clause cannot be used with the current DDL
This resource here explains why it isn't a valid clause:
https://docs.oracle.com/en/database/oracle/oracle-database/23/errmg/ORA-09870.html#GUID-3FF4C160-2D5E-45B9-AA16-12A048CEF8BA
ORA-11557: IF EXISTS clause cannot be used with the current DDL
Cause: IF EXISTS clause cannot be used with DDL statements that may move data, DDLs that recompile a materialized view, DDLs that alter an index or DDLs that drop a private temporary table. Examples: ALTER TABLE table ADD|DROP PARTITION ... ALTER TABLE table COALESCE PARTITION ... ALTER TABLE table MOVE ... ALTER MATERIALIZED VIEW <mat_view> MERGE PARTITIONS ... ALTER MATERIALIZED VIEW <mat_view> COMPILE ... ALTER INDEX index ... DROP TEMPORARY TABLE ... Please check the documentation for a list of DDL statements that are not supported.