查询脚本 :
SELECT
CASE WHEN a.column_id=1 THEN a.TABLE_NAME ELSE '' END AS 表名,
a.column_id AS 序号,
a.column_name as 列名,
REPLACE(comments, CHR(10), ' ') as 列说明,
a.data_type || '(' || a.data_length || ')' as 数据类型,
a.DATA_LENGTH AS 长度,
a.DATA_PRECISION AS 小数位数,
CASE WHEN a.column_name=(SELECT col.column_name
FROM user_constraints con,user_cons_columns col
WHERE con.constraint_name=col.constraint_name and con.constraint_type='P'
AND col.table_name=a.TABLE_NAME AND rownum<=1
) THEN 'Y' ELSE 'N' END AS 主键,
a.NULLABLE as 允许空,
a.DATA_DEFAULT AS 默认值
FROM user_tab_columns a,user_col_comments b
WHERE a.TABLE_NAME = b.table_name and a.column_name = b.column_name
AND a.TABLE_NAME=upper('表名')
ORDER BY a.TABLE_NAME,a.column_id;
显示结果 :