The COMMENT statement adds or replaces comments in the catalog descriptions of various database objects.
This statement can be embedded in an application program or issued interactively. It is an executable statement that can be dynamically prepared.
To comment on a
table, view, alias, column, type, package, sequence, variable, or
XSR object, the privileges held by the authorization ID of the statement
must include at least one of the following: 
For the table, view, alias, type, package, sequence,
variable, or XSR object in the statement,
The ALTER privilege on the table, view, alias, type,
package, sequence, variable, or XSR object, and
The system authority *EXECUTE on the library that contains
the table, view, alias, index, type, package, sequence, variable,
or XSR object

To comment on a constraint or trigger, the privileges held by the authorization ID of the statement must include at least one of the following:
To comment on an index, the privileges held by the authorization ID of the statement must include at least one of the following:
To comment on a function, the privileges held by the authorization ID of the statement must include at least one of the following:
To comment on a procedure, the privileges held by the authorization ID of the statement must include at least one of the following:
To comment on a parameter, the privileges held by the authorization ID of the statement must include at least one of the following:
To comment on a sequence, the privileges held by the authorization ID of the statement must also include at least one of the following:
To comment on a variable, the privileges held by
the authorization ID of the statement must also include at least one
of the following:

To comment on an XSR object, the privileges held
by the authorization ID of the statement must also include at least
one of the following:

For information about the system authorities corresponding to SQL privileges, see Corresponding System Authorities When Checking Privileges to a Table or View, Corresponding System Authorities When Checking Privileges to a User-defined Type, Corresponding System Authorities When Checking Privileges to a Sequence, Corresponding System Authorities When Checking Privileges to a Variable , Corresponding System Authorities When Checking Privileges to a Package, and Corresponding System Authorities When Checking Privileges to an XSR object.
>>-COMMENT--ON--------------------------------------------------> >--+-+-ALIAS--alias-name----------------------------------------------------+--IS--string-constant-+->< | +-COLUMN--+-table-name.column-name-+-----------------------------------+ | | | '-view-name.column-name--' | | | +-CONSTRAINT--constraint-name------------------------------------------+ | | +-+-+-FUNCTION-+--function-name--+------------------------------+-+----+ | | | | '-ROUTINE--' '-(--+--------------------+--)-' | | | | | | | .-,--------------. | | | | | | | | V | | | | | | | | '---parameter-type-+-' | | | | | '-SPECIFIC--+-FUNCTION-+--specific-name-------------------------' | | | | '-ROUTINE--' | | | +-INDEX--index-name----------------------------------------------------+ | | +-PACKAGE--package-name--+-------------------------+-------------------+ | | | | .-VERSION-. | | | | | '-+---------+--version-id-' | | | +-PARAMETER--+-routine-name.parameter-name---------------------------+-+ | | | '-SPECIFIC--+-FUNCTION--+--specific-name.parameter-name-' | | | | +-PROCEDURE-+ | | | | '-ROUTINE---' | | | +-+-+-PROCEDURE-+--procedure-name--+------------------------------+-+--+ | | | | '-ROUTINE---' '-(--+--------------------+--)-' | | | | | | | .-,--------------. | | | | | | | | V | | | | | | | | '---parameter-type-+-' | | | | | '-SPECIFIC--+-PROCEDURE-+--specific-name--------------------------' | | | | '-ROUTINE---' | | | +-SEQUENCE--sequence-name----------------------------------------------+ | | +-TABLE--+-table-name-+------------------------------------------------+ | | | '-view-name--' | | | +-TRIGGER--trigger-name------------------------------------------------+ | | +-TYPE--+-distinct-type-name-+-----------------------------------------+ | | | '-array-type-name----' | | | +-VARIABLE--variable-name----------------------------------------------+ | | '-XSROBJECT--xsrobject-name--------------------------------------------' | +-multiple-column-list--------------------------------------------------------------------------+ '-multiple-parameter-list-----------------------------------------------------------------------'
multiple-column-list .-,--------------------------------. .-COLUMN-. V | |--+--------+--+-table-name-+--(----column-name--IS--string-constant-+--)--| '-view-name--' multiple-parameter-list |--PARAMETER--+-SPECIFIC--+-FUNCTION--+--specific-name------------------------+--> | +-PROCEDURE-+ | | '-ROUTINE---' | | .-ROUTINE---. | '-+-----------+--routine-name--+------------------------------+-' +-FUNCTION--+ '-(--+--------------------+--)-' '-PROCEDURE-' | .-,--------------. | | V | | '---parameter-type-+-' .-,-----------------------------------. V | >--(----parameter-name--IS--string-constant-+--)----------------| parameter-type |----data-type--+------------+----------------------------------| '-AS LOCATOR-' data-type |--+-built-in-type------+---------------------------------------| '-distinct-type-name-'
built-in-type |--+-+---SMALLINT---+----------------------------------------------------------------------+--| | +-+-INTEGER-+--+ | | | '-INT-----' | | | '---BIGINT-----' | | .-(5,0)------------------------. | +-+-+-DECIMAL-+-+--+------------------------------+-------------------------------------+ | | '-DEC-----' | | .-,0--------. | | | '-+-NUMERIC-+-' '-(--integer--+-----------+--)-' | | '-NUM-----' '-, integer-' | | .-(--52--)------. | +-+-FLOAT--+---------------+-+----------------------------------------------------------+ | | '-(--integer--)-' | | | +-REAL---------------------+ | | | .-PRECISION-. | | | '-DOUBLE--+-----------+----' | | .-(--34--)-. | +---DECFLOAT--+----------+--------------------------------------------------------------+ | '-(--16--)-' | | .-(--1--)-------. | +-+-+-+-CHARACTER-+--+---------------+----------+--+----------------+-----------------+-+ | | | '-CHAR------' '-(--integer--)-' | +-FOR BIT DATA---+ | | | | '-+-+-CHARACTER-+--VARYING-+--(--integer--)-' +-FOR SBCS DATA--+ | | | | | '-CHAR------' | +-FOR MIXED DATA-+ | | | | '-VARCHAR----------------' '-ccsid-clause---' | | | | .-(--1M--)-------------. | | | '---+-+-CHARACTER-+--LARGE OBJECT-+----+----------------------+--+----------------+-' | | | '-CHAR------' | '-(--integer--+---+--)-' +-FOR SBCS DATA--+ | | '-CLOB------------------------' +-K-+ +-FOR MIXED DATA-+ | | +-M-+ '-ccsid-clause---' | | '-G-' | | .-(--1--)-------. | +-+---GRAPHIC----+---------------+-------+--+--------------+----------------------------+ | | '-(--integer--)-' | '-ccsid-clause-' | | +-+-GRAPHIC VARYING-+--(--integer--)---+ | | | '-VARGRAPHIC------' | | | | .-(--1M--)-------------. | | | '---DBCLOB----+----------------------+-' | | '-(--integer--+---+--)-' | | +-K-+ | | +-M-+ | | '-G-' | | .-(--1--)-------. | +-+-+-+-NATIONAL CHARACTER-+--+---------------+----------+---------------------+--------+ | | | +-NATIONAL CHAR------+ '-(--integer--)-' | | | | | | '-NCHAR--------------' | | | | | '-+-+-NATIONAL CHARACTER-+--VARYING-+--(--integer--)-' | | | | | +-NATIONAL CHAR------+ | | | | | | '-NCHAR--------------' | | | | | '-NVARCHAR------------------------' | | | | .-(--1M--)-------------. | | | '-----+-+-NATIONAL CHARACTER-+--LARGE OBJECT-+------+----------------------+-' | | | '-NCHAR--------------' | '-(--integer--+---+--)-' | | '-NCLOB--------------------------------' +-K-+ | | +-M-+ | | '-G-' | | .-(--1--)-------. | +-+-+-BINARY--+---------------+---------+-----------------+-----------------------------+ | | | '-(--integer--)-' | | | | | '-+-BINARY VARYING-+--(--integer--)-' | | | | '-VARBINARY------' | | | | .-(--1M--)-------------. | | | '---+-BLOB----------------+----+----------------------+-' | | '-BINARY LARGE OBJECT-' '-(--integer--+---+--)-' | | +-K-+ | | +-M-+ | | '-G-' | +-+-DATE-------------------+------------------------------------------------------------+ | | .-(--0--)-. | | | +-TIME--+---------+------+ | | | .-(--6--)-. | | | '-TIMESTAMP--+---------+-' | | .-(--200--)-----. | +---DATALINK--+---------------+--+--------------+---------------------------------------+ | '-(--integer--)-' '-ccsid-clause-' | +---ROWID-------------------------------------------------------------------------------+ '---XML---------------------------------------------------------------------------------' ccsid-clause |--CCSID--integer-----------------------------------------------|
If function-name () is specified, the function identified must have zero parameters.
If an unqualified distinct type name is specified, the database manager searches the SQL path to resolve the schema name for the distinct type.
For data types that have a length, precision, or scale attribute, use one of the following:
Specifying the FOR DATA clause or CCSID clause is optional. Omission of either clause indicates that the database manager ignores the attribute when determining whether the data types match. If either clause is specified, it must match the value that was implicitly or explicitly specified in the CREATE FUNCTION statement.
Specifies that the function is defined to receive a
locator for this parameter. If AS LOCATOR is specified, the data type
must be a LOB or XML or a distinct type based on a LOB or XML. If
AS LOCATOR is specified, FOR SBCS DATA or FOR MIXED DATA must not
be specified.
If procedure-name () is specified, the procedure identified must have zero parameters.
If
an unqualified distinct type or array type name is specified, the
database manager searches the SQL path to resolve the schema name
for the distinct type or array type.
For data types that have a length, precision, or scale attribute, use one of the following:
Specifying the FOR DATA clause or CCSID clause is optional. Omission of either clause indicates that the database manager ignores the attribute when determining whether the data types match. If either clause is specified, it must match the value that was implicitly or explicitly specified in the CREATE PROCEDURE statement.
Specifies that the procedure is defined to receive
a locator for this parameter. If AS LOCATOR is specified, the data
type must be a LOB or XML or a distinct type based on a LOB or XML.
If AS LOCATOR is specified, FOR SBCS DATA or FOR MIXED DATA must not
be specified.
TYPE distinct-type-name or array-type-name
Identifies
the distinct type or array type to which the comment applies. The distinct-type-name or array-type-name must
identify a type that exists at the current server.
VARIABLE variable-name
Identifies
the variable to which the comment applies. The variable-name must
identify a variable that exists at the current server.
XSROBJECT xsrobject-name
Identifies
the XSR object to which the comment applies. The xsrobject-name must
identify an XSR object that exists at the current server.
To comment on more than one column in a table or view, specify the table or view name and then, in parenthesis, a list of the form:
(column-name IS string-constant, column-name IS string-constant, ... )
The column name must not be qualified, each name must identify a column of the specified table or view, and that table or view must exist at the current server.
To comment on more than one parameter in a procedure or function, specify the procedure name, function name, or specific name, and then, in parenthesis, a list of the form:
(parameter-name IS string-constant, parameter-name IS string-constant, ... )
The parameter name must not be qualified, each name must identify a parameter of the specified procedure or function, and that procedure or function must exist at the current server.
Syntax alternatives: The following keywords are synonyms supported for compatibility to prior releases. These keywords are non-standard and should not be used:
Example 1: Insert a comment for the EMPLOYEE table.
COMMENT ON TABLE EMPLOYEE IS 'Reflects first quarter 2000 reorganization'
Example 2: Insert a comment for the EMP_VIEW1 view.
COMMENT ON TABLE EMP_VIEW1 IS 'View of the EMPLOYEE table without salary information'
Example 3: Insert a comment for the EDLEVEL column of the EMPLOYEE table.
COMMENT ON COLUMN EMPLOYEE.EDLEVEL IS 'Highest grade level passed in school'
Example 4: Enter comments on two columns in the DEPARTMENT table.
COMMENT ON DEPARTMENT (MGRNO IS 'EMPLOYEE NUMBER OF DEPARTMENT MANAGER', ADMRDEPT IS 'DEPARTMENT NUMBER OF ADMINISTERING DEPARTMENT')
Example 5: Insert a comment for the PAYROLL package.
COMMENT ON PACKAGE PAYROLL IS 'This package is used for distributed payroll processing.'