select TABLE_NAME from user_tables; -- 获取表
select * from user_tab_comments; -- 获取表注释
select * from User_Col_Comments; -- 获取字段注释
-- 导出文档
SELECT
t.TABLE_NAME,
t.COLUMN_NAME,
REPLACE (
REPLACE ( REPLACE ( t1.COMMENTS, chr( 10 ), '' ), chr( 13 ), '' ),
chr( 9 ),
''
),
t.DATA_TYPE,
t.DATA_LENGTH,
NVL( NULL, '' ),
NVL( NULL, '' ),
t.NULLABLE,
NVL( NULL, '无' ),
case when t.COLUMN_NAME = 'ID' THEN '是' else '否' end ,
REPLACE (
REPLACE ( REPLACE ( t1.COMMENTS, chr( 10 ), '' ), chr( 13 ), '' ),
chr( 9 ),
''
),
NVL( NULL, '新增' ),
NVL( NULL, '' )
FROM
user_tab_columns t,
User_Col_Comments t1
WHERE
t.TABLE_NAME =t1.TABLE_NAME
and t1.column_name = t.COLUMN_NAME
and t.TABLE_NAME = 'SCFP_XP_CJXP_XXFWS' --表名 需要修改
ORDER BY
COLUMN_ID;
本文档参考:https://blog.51cto.com/meiling/2068902