Oracle SQL - Table COMMENT Command


The COMMENT command can add explanations about tables and table columns to the data dictionary.

The following code shows how you can use the COMMENT command to add comments to the data dictionary for a table and a column and how you can retrieve that information from the data dictionary.

SQL> comment on table salgrades
  2  is     'Salary grades and net bonuses';
Comment created.

SQL> comment on column emp.comm
  2  is     'For sales reps only';
Comment created.

SQL> select comments
  2  from   user_tab_comments
  3  where  table_name = 'SALGRADES';

SQL> select comments
  2  from   user_col_comments
  3  where  table_name  = 'EMPLOYEES'
  4  and    column_name = 'COMM';