--一般用這個就行了
SELECT
B.COLUMN_Name AS 字段名, B.DATA_TYPE AS 字段類型, case when c.column_name is not null then 'P' end 主鍵, B.DATA_LENGTH AS 字段長度, case when B.NULLABLE='N' then '否' else '是' end AS 是否為空, decode(B.NULLABLE,'N', decode(B.DATA_TYPE,'NUMBER','0','DATE','SYSDATE') ) AS 字段默認(rèn)值, Comments AS 字段說明 FROM USER_COL_COMMENTS A, USER_TAB_COLUMNS B ,all_ind_columns c where 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.TABLE_NAME='USERS' order by b.table_name,b.COLUMN_ID select t.COLUMN_NAME as 字段名,
t.DATA_TYPE as 字段類型, t.DATA_LENGTH as 字段長度, t.DATA_PRECISION as 數(shù)據(jù)精度, t.DATA_SCALE as 小數(shù)位, case when t.NULLABLE='Y' then '是' else '否' end as 是否允許為空, c.COMMENTS as 備注 from user_tab_columns t, user_col_comments c where t.table_name = c.table_name and t.column_name = c.column_name and t.table_name = 'USERS' order by t.COLUMN_ID ; |
|