Oracle Table and Column Comments

Contents


Adding comments to tables and columns

After the table is created you should document the data model with comments so to have easy access when urgent troubleshooting is required or 3rd party need to interface.
  comment on table dep 'This table holds all departments names ';
  comment on column dep.name 'holds the deparment name';
  comment on column dep.id 'holds the generic deparment id';
  comment on column dep.createndate 'holds the date when the deparment was established';

How to get table comments via SQL in Oracle?


Table comments can be accessed through these data dictionary views:
_TAB_COMMENTS for tables.
   SELECT  table_name ,comments
   FROM user_tab_comments
   WHERE lower(table_name) in ('footab', 'bartab');	   
   TABLE_NAME	COMMENTS
   BARTAB	Link Table for Tariff Model Elements
   FOOTAB	Tariff Models

   SELECT * 
   FROM dba_tab_comments	 						 
   WHERE owner = 'ME' and lower (comments) like '%scenario%'

How to get column comments via SQL in Oracle?

Column comments can be accessed through these data dictionary views:
_COL_COMMENTS for columns.

   SELECT column_name, comments
   FROM user_col_comments
   WHERE table_name=upper('footab');
   SUBSCRIPT	Subscription Fee
   ACCESSFEE	Recurring Access fee
   EVENT	Event fee


See Also:
Oracle-Dictionary-Views


Status: Published Date: 2017/06/05 14:14:14 Revision: 1.1

Copyright bei Andreas Haack (C) 2014. Diese Seite wird so wie sie ist zur Verfuegung gestellt, ohne irgenweche Garantien der Verwendbarkeit fuer bestimte Zwecke. Die auf dieser Seiten angebrachten Links liegen ausserhalb der redaktionellen Verantwortung von Andreas Haack und es wird keine Haftung oder Garantie uebernommen. Die Seiten sind Copyright (c) 2014 von Andreas Haack. Kein Teil darf ohne die schriftliche Einverstaendnis von Andreas Haack veroeffentlicht werden.
The page is provided 'as is' , without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fit- ness for a particular purpose and non-infringement. In no event shall Andreas Haack be liable for any claim, damages or other liability. This page is copyrighted property of Andreas Haack. Copyright by Andreas Haack (c) 2014 . No part of this page may be published without written permission for Andreas Haack. A hyper-link may created to this page but NOT to the embedded elements of this page. It may be freely downloaded for private purpose only as long as it is unaltered.