查询数据库里所有表结构和字段的sql语句

余生长醉 提交于 2020-01-14 02:32:30

SELECT A.TABLE_NAME AS “表名”,
A.COLUMN_NAME AS “字段名”,
DECODE(A.CHAR_LENGTH,
0,
DECODE(A.DATA_SCALE,
NULL,
A.DATA_TYPE,
A.DATA_TYPE || ‘(’ || A.DATA_PRECISION || ‘,’ ||
A.DATA_SCALE || ‘)’),
A.DATA_TYPE || ‘(’ || A.CHAR_LENGTH || ‘)’) as “字段类型”,
–A.DATA_DEFAULT AS “默认值”,
A.NULLABLE AS “能否为空”,
B.comments AS “备注”
FROM sys.all_tab_columns A, sys.DBA_COL_COMMENTS B
WHERE A.owner = B.owner
AND A.table_name = B.table_name
AND A.COLUMN_NAME = B.COLUMN_NAME
AND A.owner = ‘Y9_FLOWABLE’
AND A.TABLE_NAME like ‘ZNHT_%’
ORDER BY A.TABLE_NAME,a.column_id;

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!