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.
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 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:
For information on 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-' | | | +-INDEX--index-name----------------------------------+ | | +-PACKAGE--package-name--+-------------------------+-+ | | | | .-VERSION-. | | | | | '-+---------+--version-id-' | | | +-SEQUENCE--sequence-name----------------------------+ | | '-TABLE--+-table-name-+------------------------------' | | '-view-name--' | | .-,--------------------------------. | | .-COLUMN-. V | | +-+--------+--+-table-name-+--(----column-name--IS--string-constant-+--)-------+ | '-view-name--' | | .-,--------------------------------------. | | .-COLUMN-. V | | '-+--------+--+-table-name-+--(----column-name--TEXT--IS--string-constant-+--)-' '-view-name--'
The label for a column heading consists of three 20-byte segments. Interactive SQL, the Query/400 program, IBM DB2 Query Manager and SQL Development Kit for iSeries, 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.
LABEL ON COLUMN DEPARTMENT.DEPTNO IS 'DEPARTMENT NUMBER'
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.
LABEL ON PACKAGE PAYROLL IS 'Payroll Package'