|
-
1 CREATE OR REPLACE PROCEDURE index_rebuilt (
2 table_name IN VARCHAR2)
3 IS
4 TYPE cv_type IS REF CURSOR;
5 cv cv_type;
6 val VARCHAR2(32767);
7 BEGIN
8 /* Construct the very dynamic query and open the cursor. */
9 OPEN cv FOR
10 'select index_name from dba_indexes where table_name = ''' || table_name ||
11 ''' and status = ''UNUSABLE''';
12 LOOP
13 /* Fetch the next row, and stop if no more rows. */
14 FETCH cv INTO val;
15 EXIT WHEN cv%NOTFOUND;
16 EXECUTE IMMEDIATE 'ALTER INDEX MDM3.' || val || ' REBUILD ONLINE PARALLEL 7 ';
17 END LOOP;
18 CLOSE cv;
19* END;
SQL> /
Procedure created.
SQL>
SQL>
SQL>
SQL>
SQL>
SQL> exec index_rebuilt('T_OLD_CMPN_HIST_XTRCT');
BEGIN index_rebuilt('T_OLD_CMPN_HIST_XTRCT'); END;
*
ERROR at line 1:
ORA-00942: table or view does not exist
ORA-06512: at "MDM3.INDEX_REBUILT", line 9
ORA-06512: at line 1
SQL>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|