日期:2014-05-17 浏览次数:20927 次
SELECT * from user_indexes s WHERE S.table_name='EMP'
------解决方案--------------------
--这样能否满足你的需求 SELECT COLUMN_NAME, DATA_TYPE, COMMENTS, KEY, wm_concat(index_name) index_name, NULLABLE FROM (SELECT A.COLUMN_NAME, decode(A.DATA_TYPE, 'CHAR', A.DATA_TYPE || '(' || A.DATA_LENGTH || ')', 'DATE', A.DATA_TYPE, 'NUMBER', A.DATA_TYPE, 'VARCHAR2', A.DATA_TYPE || '(' || A.DATA_LENGTH || ')') AS DATA_TYPE, B.comments, decode(C.COLUMN_NAME, NULL, 'No', 'Yes') AS Key, d.index_name, decode(A.NULLABLE, 'N', 'NOT NULL', 'Y', 'NULL') AS NULLABLE FROM sys.user_tab_cols A, sys.user_col_comments B, (SELECT col.column_name, c.table_name FROM user_constraints c, user_cons_columns col WHERE c.constraint_name = col.constraint_name AND c.constraint_type = 'P') C, user_ind_columns d WHERE upper(A.TABLE_NAME) = '表名' AND A.TABLE_NAME = B.table_name AND A.COLUMN_NAME = B.column_name AND A.Table_Name = C.TABLE_NAME(+) AND A.COLUMN_NAME = C.COLUMN_NAME(+) AND b.column_name = d.column_name(+)) GROUP BY COLUMN_NAME, DATA_TYPE, COMMENTS, KEY, NULLABLE;