Just replace the second select statement with this:
HTH,Code:select index_name "SORT1",
'2' "SORT2",
'select '''||index_name||''', to_char(sysdate,'||'''dd-Mon-yyyy hh24:mi:ss'''||') from dual;' "CMDLINE"
from dba_indexes
where owner = 'SCOTT'
;
/
gtcol