Alter inside a loop statement
492416Jan 26 2007 — edited Jan 26 2007Hello, I'm trying to rebuild partitions that are unusables but I have an error when in Alter index statement..symbol not allowed.
Help you be appreciated
Thanks
Gonçalo Ribeiro
(GNR)
......................................................
v_index_name user_ind_partitions.INDEX_NAME%type;
v_partition_name user_ind_partitions.PARTITION_NAME%type;
v_tablespace_name user_ind_partitions.TABLESPACE_NAME%type;
CURSOR c1 IS select index_name, partition_name, tablespace_name
from user_ind_partitions where like '%UNUSABLE%';
...............................................
BEGIN
LOOP
FETCH c1 INTO v_index_name, v_partition_name, v_tablespace_name;
/***DEGBUG********************************/
DBMS_OUTPUT.PUT_LINE(v_index_name);
DBMS_OUTPUT.PUT_LINE(v_partition_name);
DBMS_OUTPUT.PUT_LINE(v_tablespace_name);
/*** END DEGBUG*******************************/
ALTER INDEX v_index_name REBUILD PARTITION v_partition_name
TABLESPACE v_tablespace_name;
EXIT WHEN c1%NOTFOUND;
END LOOP;
END;