先介绍四个Oracle的表:
all_tab_comments,user_tab_comments,all_col_comments,user_col_comments。
1、all_tab_comments,展示当前用户能访问到的表和视图的信息,表结构如下:
2、user_tab_comments,展示 属于当前用户的 表和视图的信息,比all_tab_comments少OWNER列,表结构如下:
3、all_col_comments,显示 当前用户可以访问的 表和视图的列上的注释,结构如下:
4、user_col_comments,显示 属于当前用户的 表和视图的列上的注释,没有OWNER列,结构如下:
获取表的相关信息:
select * from all_tab_comments where table_name= upper(tablename) ; --查询 tablename表的信息,表名须大写。
select * from all_col_comments where table_name=upper(tablename) ; --查询表的列信息