Oracle数据库查询表结构、字段及注释信息

create or replace view sys.user_col_comments
(table_name, column_name, comments)
as
select o.name, c.name, co.comment$
from sys."_CURRENT_EDITION_OBJ" o, sys.col$ c, sys.com$ co
where o.owner# = userenv('SCHEMAID')
  and o.type# in (2, 4)
  and o.obj# = c.obj#
  and c.obj# = co.obj#(+)
  and c.intcol# = co.col#(+)
  and bitand(c.property, 32) = 0 /* not hidden column */;
comment on table SYS.USER_COL_COMMENTS is 'Comments on columns of user''s tables and views';
comment on column SYS.USER_COL_COMMENTS.TABLE_NAME is 'Object name';
comment on column SYS.USER_COL_COMMENTS.COLUMN_NAME is 'Column name';
comment on column SYS.USER_COL_COMMENTS.COMMENTS is 'Comment on the column';

使用方式:

select * from user_col_comments

你可能感兴趣的:(Oracle与数据处理)