So I have a block of PLSQL code that will drop all indexes as shown in the following block of code:
DECLARE
DRP_STMNT VARCHAR2(100) := '';
BEGIN
FOR I IN (SELECT INDEX_NAME FROM USER_INDEXES) LOOP
DRP_STMNT := 'DROP INDEX ' || I.INDEX_NAME;
EXECUTE IMMEDIATE DRP_STMNT;
END LOOP;
END;
/
That will do the job but should I use a cursor instead of embedding my SELECT statement within the FOR LOOP?
Does the FOR LOOP look at the entire table or does it process one row at a time?
What do you guys suggest using and why?