Select columns of table index

前端 未结 3 1216
清酒与你
清酒与你 2021-01-28 12:05

Oracle has a query that selects the existing indexes of a table. For example:

SELECT * FROM user_indexes WHERE table_name = \'CM_WCEL\';

But

相关标签:
3条回答
  • 2021-01-28 12:25

    this should provide needed information:

     select index_name, column_name
     from user_ind_columns
     where table_name = 'CM_WCEL';
    
    0 讨论(0)
  • 2021-01-28 12:31

    As per the creation of table, the below tables will have the requested information.

    SELECT *
    FROM user_ind_columns
    WHERE table_name = 'CM_WCEL';
    

    or

    SELECT *
    FROM dba_ind_columns
    WHERE table_name = 'CM_WCEL';
    
    0 讨论(0)
  • 2021-01-28 12:39

    To get the complete DDL for each index, use dbms_metadata.get_ddl():

    select index_name, dbms_metadata.get_ddl('INDEX', index_name) as ddl
    from user_indexes
    where table_name = CM_WCEL';
    

    The DDL is returned as a CLOB. Depending on the SQL client you are using you might need some configuration changes to be able to see the complete code. e.g. in SQL*Plus you need something set long 60000 before you run the select statement.

    0 讨论(0)
提交回复
热议问题