LABEL

The LABEL statement adds or replaces labels in the catalog descriptions of various database objects.

Invocation

This statement can be embedded in an application program or issued interactively. It is an executable statement that can be dynamically prepared.

Authorization

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.

Syntax

Click to skip syntax diagram
Read syntax diagramSkip visual syntax diagram>>-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--'
 

Description

ALIAS
Specifies that the label is for an alias. Labels on aliases are implemented as system object text.
alias-name
Identifies the alias to which the label applies. The name must identify an alias that exists at the current server.
COLUMN
Specifies that the label is for a column. Labels on columns are implemented as system column headings or column text. Column headings are used when displaying or printing query results.
table-name.column-name or view-name.column-name
Identifies the column to which the label applies. The table-name or view-name must identify a table or view that exists at the current server, but must not identify a global temporary table. The column-name must identify a column of that table or view.
TEXT
Specifies that i5/OS column text is specified. If TEXT is omitted, a column heading is specified.
INDEX
Specifies that the label is for an index. Labels on indexes are implemented as system object text.
index-name
Identifies the index to which the label applies. The name must identify an index that exists at the current server.
PACKAGE
Specifies that the label is for a package. Labels on packages are implemented as system object text.
package-name
Identifies the package to which the label applies. The name must identify a package that exists at the current server.
VERSION version-id
version-id is the version identifier that was assigned to the package when it was created. If version-id is not specified, a null string is used as the version identifier.
SEQUENCE
Specifies that the label is for a sequence. Labels on sequences are implemented as system object text.
sequence-name
Identifies the sequence on which you want to add a label. The sequence-name must identify a sequence that exists at the current server.
TABLE
Specifies that the label is for a table or a view. Labels on tables or views are implemented as system object text.
table-name or view-name
Identifies the table or view on which you want to add a label. The table-name or view-name must identify a table or view that exists at the current server, but must not identify a global temporary table.
IS
Introduces the label you want to provide.
string-constant
Can be any SQL character-string constant of up to either 50 bytes in length for tables, views, aliases, SQL packages, sequences, or column text, or 60 bytes in length for column headings. The constant may contain single-byte and double-byte characters.

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.

Notes

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:

Examples

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'


[ Top of Page | Previous Page | Next Page | Contents | Index ]