Oracle uses comment statements to add Table Comments
The oracle comment statement can be used to add remarks to tables, fields, views, and other objects.
Syntax:
Comment on TABLE table_name IS 'Remarks ';
Permission requirements:
By default, users can only add comments to their own objects.
If you want to add comments to other user objects, you must have the following permissions:COMMENT ANY TABLE
Related Data Field View:
USER_TAB_COMMENTS
DBA_TAB_COMMENTS
ALL_TAB_COMMENTS
USER_COL_COMMENTS
DBA_COL_COMMENTS
ALL_COL_COMMENTS
Example:
Drop table t;
Create table t (id number );
Select * from user_tab_comments;
TABLE_NAME TABLE_TYPE COMMENTS
------------------------------------------------------------------------------------------
T TABLE
Select * from USER_COL_COMMENTS;
SCOTT @ orcl> select * from USER_COL_COMMENTS WHERE table_name = 'T ';
TABLE_NAME COLUMN_NAME COMMENTS
------------------------------------------------------------------------------------------
T ID
-- Add comments
SCOTT @ orcl> comment on table t is 'test table T ';
Note created.
SCOTT @ orcl> comment on column t. id is 'row id ';
Note created.
SCOTT @ orcl> select * from user_tab_comments WHERE table_name = 'T ';
TABLE_NAME TABLE_TYPE COMMENTS
------------------------------------------------------------------------------------------
T table test TABLE T
SCOTT @ orcl> select * from USER_COL_COMMENTS WHERE table_name = 'T ';
TABLE_NAME COLUMN_NAME COMMENTS
------------------------------------------------------------------------------------------
T id row ID