COMMENT (Comment)

Function

COMMENT inserts a comment into a table or a column or changes an existing comment.

Privileges

Owner of the base table

A user can write comments into base tables owned by that user.

Format

COMMENT ON {TABLE [authorization-identifier.]table-identifier
           |COLUMN [authorization-identifier.]table-identifier.column-
            name}
           IS 'character-string'

Operands

Specifies that a comment is to be processed for a base table or column owned by the user.

Specifies TABLE to write a comment into a table; specifies COLUMN to write a comment into a column.

When specifying a public view in table-identifier, in authorization-identifier specify the word PUBLIC, all in uppercase, enclosed in double quotation marks (").

Specifies a comment in a character string. The length of a character string that can be specified is 0 to 255 bytes.

When specifying a national character string literal as a character string, you need not specify 'N'. Hexadecimal character string literals cannot be specified as a comment.

Notes

  1. An assigned comment can be referenced by retrieving the SQL_TABLES table or the SQL_COLUMNS table of the data dictionary table.
  2. When specified for an existing comment, the COMMENT function deletes the existing comment and sets the new comment.
  3. A comment cannot be inserted into a data dictionary table.
  4. The COMMENT statement cannot be specified from an X/Open-compliant UAP running under OLTP.

Examples

  1. Insert a comment into a stock table (STOCK):

    COMMENT ON TABLE STOCK IS 'CREATED JULY 1995'

  2. Insert a comment into the unit price column (PRICE) of a stock table (STOCK):

    COMMENT ON COLUMN STOCK.PRICE IS 'REVISED JULY 1995'