ORACLE数据库导出表,字段名,长度,类型,字段注释,表注释语句

--数据库导出表,字段名,长度,类型,字段注释,表注释语句
SELECT T1.TABLE_NAME 英文表名,
T1.COLUMN_NAME 字段名,
T1.DATA_TYPE || ‘(‘ || T1.DATA_LENGTH || ‘)‘ 字段类型及长度,
T2.COMMENTS 字段注释,
t3.COMMENTS 表注释
FROM USER_TAB_COLS T1, USER_COL_COMMENTS T2,user_tab_comments t3
WHERE T1.TABLE_NAME = T2.TABLE_NAME
AND T1.COLUMN_NAME = T2.COLUMN_NAME and t3.TABLE_NAME = t1.TABLE_NAME and t1.TABLE_NAME LIKE ‘GM_%‘

--用这个好,可以查全部的

SELECT
c.table_name 英文表名 ,
t.COMMENTS 中文表名称,
cc.COLUMN_NAME 字段名,
cc.COMMENTS 字段注释 ,
c.DATA_TYPE || ‘(‘ || c.DATA_LENGTH || ‘)‘ 字段类型及长度
FROM
dba_tab_columns c
LEFT JOIN dba_col_comments cc ON c.table_name = cc.table_name
AND c.column_name = cc.column_name
LEFT JOIN dba_tab_comments t ON c.table_name = t.table_name
WHERE
c.OWNER = ‘S_GMJXK‘
AND c.TABLE_NAME LIKE ‘GM_%‘
ORDER BY
c.table_name;

ORACLE数据库导出表,字段名,长度,类型,字段注释,表注释语句

上一篇:SQL Server 索引


下一篇:java.sql.SQLException: No value specified for parameter 5