Oracle查询数据库内全部的表名、列明、注释、数据类型、长度、精度
SELECT
a.TABLE_NAME 表名,
row_number() over(partition by a.TABLE_NAME order by a.COLUMN_NAME desc) 字段顺序,
a.COLUMN_NAME 列名,
b.COMMENTS 注释,
a.DATA_TYPE 数据类型,
a.DATA_LENGTH 长度,
DATA_SCALE 精度
FROM all_tab_columns a
LEFT JOIN all_col_comments b ON a.OWNER = b.OWNER AND a.TABLE_NAME = b.TABLE_NAME AND a.COLUMN_NAME = b.COLUMN_NAME
WHERE a.OWNER = '用户名'
ORDER BY 表名,字段顺序
效果图:
字段排序,根据表名对字段进行排序