I am trying to access index DDL of a table using user_indexes and DBMS_METADATA.GET_DDL
declare
V_DDL clob;
Begin
for rec in (select ai.owner, ai.index_name, ai.table_name from all_indexes ai, base_table til
where ai.table_name = upper(til.table_name)) loop
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'STORAGE',FALSE);
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'PRETTY',TRUE);
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'TABLESPACE',FALSE);
V_DDL := DBMS_METADATA.GET_DDL('INDEX',rec.Index_Name, Rec.Owner);
Insert into after_work VALUES(rec.index_name, rec.table_name, V_DDL);
end loop;
end;
/
I need to manually double click on INDEX_SCRIPT column to view the DDL script.
what I am trying understand is how to access the DDL script through the SQL. Kindly advise me on this please. thank you
I got the result as shown in the pic