oracle 查看表、视图、列的备注信息

表、视图、列的备注信息一定要做好,这个应该是规范之一。

表、视图的备注信息

select atc.*,
       case when atc.table_type='TABLE'
                 then ' comment on table '||atc.owner||'.'||atc.table_name||' is '''';'
            when atc.table_type='VIEW'
                 then ' comment on table '||atc.owner||'.'||atc.table_name||' is '''';'
        end as need_comment
  from all_tab_comments atc
 where 1=1
   and atc.owner not in ('SYS','SYSTEM','WMSYS','EXPSYS')
   and atc.owner in ('SCOTT')
   and nvl(atc.comments,' ') = ' '
 order by atc.owner,atc.table_type,atc.table_name
;

列的备注信息

select acc.*,
       ' comment on table '||acc.owner||'.'||acc.table_name||'.'||acc.column_name||' is '''';' as need_comment
  from all_col_comments acc
 where 1=1
   and acc.owner not in ('SYS','SYSTEM','WMSYS','EXPSYS')
   and acc.owner in ('SCOTT')
   and nvl(acc.comments,' ') = ' '
 order by acc.owner,acc.table_name
;

发布了710 篇原创文章 · 获赞 70 · 访问量 49万+

猜你喜欢

转载自blog.csdn.net/ctypyb2002/article/details/103311663
今日推荐