--导出、生成当前用户的所有表和视图的注释
select 'comment on table '||a.table_name|| ' is '||''''||a.comments||''''||';'
from user_tab_comments a
where a.table_type in('TABLE','VIEW');
--导出、生成当前用户的所有表字段的注释
select 'comment on column '||t.table_name||'.'||t.column_name||' is '||''''||t.comments||''''||';'
from user_col_comments t
--导出、生成所有表的注释(需要dba权限)
select 'comment on table '||t.owner||'.'||t.table_name||' is '||''''||t.comments||''''||';'
from dba_tab_comments t
where t.table_type='TABLE' or t.table_type='VIEW';
--导出、生成所有字段的注释
select 'comment on column '||t.owner||'.'||t.table_name||'.'||t.column_name||' is '||''''||t.comments||''''||';'
from dba_col_comments t;