Skip Headers
Oracle® Database SQL Reference
10g Release 2 (10.2)

Part Number B14200-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

COMMENT

Purpose

Use the COMMENT statement to add a comment about a table, view, materialized view, or column into the data dictionary.

To drop a comment from the database, set it to the empty string ' '.

See Also:

  • "Comments" for more information on associating comments with SQL statements and schema objects

  • Oracle Database Reference for information on the data dictionary views that display comments

Prerequisites

The object about which you are adding a comment must be in your own schema or:

Syntax

comment::=

Description of comment.gif follows
Description of the illustration comment.gif

Semantics

TABLE Clause

Specify the schema and name of the table or materialized view to be commented. If you omit schema, then Oracle Database assumes the table or materialized view is in your own schema.

Note:

In earlier releases, you could use this clause to create a comment on a materialized view. You should now use the COMMENT ON MATERIALIZED VIEW clause for materialized views.

COLUMN Clause

Specify the name of the column of a table, view, or materialized view to be commented. If you omit schema, then Oracle Database assumes the table, view, or materialized view is in your own schema.

You can view the comments on a particular table or column by querying the data dictionary views USER_TAB_COMMENTS, DBA_TAB_COMMENTS, or ALL_TAB_COMMENTS or USER_COL_COMMENTS, DBA_COL_COMMENTS, or ALL_COL_COMMENTS.

OPERATOR Clause

Specify the name of the operator to be commented. If you omit schema, then Oracle Database assumes the operator is in your own schema.

You can view the comments on a particular operator by querying the data dictionary views USER_OPERATOR_COMMENTS, DBA_OPERATOR_COMMENTS, or ALL_OPERATOR_COMMENTS.

INDEXTYPE Clause

Specify the name of the indextype to be commented. If you omit schema, then Oracle Database assumes the indextype is in your own schema.

You can view the comments on a particular indextype by querying the data dictionary views USER_INDEXTYPE_COMMENTS, DBA_INDEXTYPE_COMMENTS, or ALL_INDEXTYPE_COMMENTS.

MATERIALIZED VIEW Clause

Specify the name of the materialized view to be commented. If you omit schema, then Oracle Database assumes the materialized view is in your own schema.

You can view the comments on a particular materialized view by querying the data dictionary views USER_MVIEW_COMMENTS, DBA_MVIEW_COMMENTS, or ALL_MVIEW_COMMENTS.

IS 'string'

Specify the text of the comment. Please refer to "Text Literals" for a syntax description of 'string'.

Example

Creating Comments: Example To insert an explanatory remark on the job_id column of the employees table, you might issue the following statement:

COMMENT ON COLUMN employees.job_id 
   IS 'abbreviated job title';

To drop this comment from the database, issue the following statement:

COMMENT ON COLUMN employees.job_id IS ' ';