The LABEL statement adds or replaces labels 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 label a table,
view, alias, column, type, package, sequence, view, 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, XSR object, function or procedure identified in the statement,
The ALTER privilege on the table, view, alias, type,
package, sequence, variable, XSR object, function or procedure, and
The system authority *EXECUTE on the library containing
the table, view, alias, type, package, sequence, variable, XSR object,
function or procedure

To label a constraint or trigger, the privileges held by the authorization ID of the statement must include at least one of the following:
To label an index, the privileges held by the authorization ID of the statement must include at least one of the following:
To label a function, the privileges held by the authorization ID of the statement must include at least one of the following:
To label a procedure, the privileges held by the authorization ID of the statement must include at least one of the following:
To label a sequence, the privileges held by the authorization ID of the statement must also include at least one of the following:
The authorization ID of the statement has the ALTER privilege on an alias when:
To label a variable, the privileges held by the
authorization ID of the statement must also include at least one of
the following:

To label 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 Sequence, and Corresponding System Authorities When Checking Privileges to a Package.
>>-LABEL--ON----------------------------------------------------> >--+-+-ALIAS--alias-name---------------------------------------------------+--IS--string-constant-+->< | +-COLUMN--+-table-name.column-name-+--+------+------------------------+ | | | '-view-name.column-name--' '-TEXT-' | | | +-CONSTRAINT--constraint-name-----------------------------------------+ | | +-+-+-FUNCTION-+--function-name--+------------------------------+-+---+ | | | | '-ROUTINE--' '-(--+--------------------+--)-' | | | | | | | .-,--------------. | | | | | | | | V | | | | | | | | '---parameter-type-+-' | | | | | '-SPECIFIC--+-FUNCTION-+--specific-name-------------------------' | | | | '-ROUTINE--' | | | +-INDEX--index-name---------------------------------------------------+ | | +-PACKAGE--package-name--+-------------------------+------------------+ | | | | .-VERSION-. | | | | | '-+---------+--version-id-' | | | +-+-+-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-------------------------------------------' | | .-,--------------------------------. | | .-COLUMN-. V | | +-+--------+--+-table-name-+--(----column-name--IS--string-constant-+--)-----------------------+ | '-view-name--' | | .-,--------------------------------------. | | .-COLUMN-. V | | '-+--------+--+-table-name-+--(----column-name--TEXT--IS--string-constant-+--)-----------------' '-view-name--' 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.
Identifies
the distinct type or array type to which the label 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 label applies. The variable-name must
identify a variable that exists at the current server.
XSROBJECT xsrobject-name
Identifies
the XSR object to which the label applies. The xsrobject-name must
identify an XSR object that exists at the current server.
The label for a column heading consists of three 20-byte segments. Interactive SQL, the Query for IBM i, IBM DB2® Query Manager and SQL Development Kit for i, and other products can display or print each 20-byte segment on a separate line. If the label for a column contains mixed data, each 20-byte segment must be a valid mixed data character string. The shift characters must be paired within each 20-byte segment.
Column headings: Column headings are used when displaying or printing query results. The first column heading is displayed or printed on the first line, the second column heading is displayed or printed on the second line, and the third column heading is displayed or printed on the third line. The column headings can be up to 60 bytes in length, where the first 20 bytes is the first column heading, the second 20 bytes is the second column heading, and the third 20 bytes is the third column heading. Blanks are trimmed from the end of each 20-byte column heading.
All 60 bytes of column heading information are available in the catalog view SYSCOLUMNS; however, only the first column heading is returned in an SQLDA on a DESCRIBE or DESCRIBE TABLE statement.
Column text is not returned on a DESCRIBE or DESCRIBE TABLE statement. When the database manager changes the column heading information in a record format description that is shared, the change is reflected in all files sharing the format description. To find out if a file shares a format with another file, use the RCDFMT parameter on the CL command, Display Database Relations (DSPDBR).
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: Enter a label on the DEPTNO column of table DEPARTMENT.
Example 2: Enter a label on the DEPTNO column of table DEPARTMENT where the column heading is shown on two separate lines.
LABEL ON COLUMN DEPARTMENT.DEPTNO IS 'Department Number'
Example 3: Enter a label on the PAYROLL package.