I have for in loop to rebuild indexes of certain tables that have changed primary key. Anyway to select only indexes of these tables from USER_OBJECTS
linking with TABLE_NAME
in USER_TABLES
, also to exclude any IOT table's index.
FOR r IN (SELECT OBJECT_NAME AS OBJ FORM USER_OBJECTS WHERE OBJECT_TYPE = 'INDEX') LOOP
l_sql := 'ALTER INDEX '||r.obj||' REBUILD'||'';
EXECUTE IMMEDIATE l_sql;
END LOOP;
Above code just simply rebuild all indexes in the schema (included IOT, hence hit error ORA-28650: Primary index on an IOT cannot be rebuilt
)