FOR r IN (select 'DRR_DEV.' ||object_name as obj from dba_objects where object_type = 'INDEX'
and owner ='DRR_DEV')
LOOP
l_sql := 'ALTER INDEX '||r.obj||' REBUILD'||'';
execute immediate l_sql;
END LOOP;
在 FOR..IN 循环之上,循环特定模式的所有索引并重建。我在循环开始和 ALTER 语句行几乎没有错误。
PL/SQL: SQL Statement ignored
PL/SQL: ORA-00942: table or view does not exist
PL/SQL: Statement ignored
PLS-00364: loop index variable 'R' use is invalid
我可以手动运行 select 语句,但不能通过 PLSQL 块,可能会出现什么问题?