Creating descriptive labels using the LABEL ON statement

 

Sometimes the table name, column name, view name, index name, sequence name, alias name, or SQL package name does not clearly define data that is shown on an interactive display of the table. You can create a more descriptive label for these names by using the LABEL ON statement.

These labels can be seen in the SQL catalog in the LABEL column.

The LABEL ON statement looks like this:

   LABEL ON      TABLE CORPDATA.DEPARTMENT IS 'Department Structure Table'
 
   LABEL ON      COLUMN CORPDATA.DEPARTMENT.ADMRDEPT IS 'Reports to Dept.'

After these statements are run, the table named DEPARTMENT displays the text description as Department Structure Table and the column named ADMRDEPT displays the heading Reports to Dept. The label for tables, views, indexes, sequence, SQL packages, and column text cannot be more than 50 characters and the label for column headings cannot be more than 60 characters (blanks included). The following are examples of LABEL ON statements for column headings:

This LABEL ON statement provides column heading 1 and column heading 2:

   *...+....1....+....2....+....3....+....4....+....5....+....6..*
   LABEL ON COLUMN CORPDATA.EMPLOYEE.EMPNO IS
             'Employee            Number'
 

This LABEL ON statement provides three levels of column headings for the SALARY column:

   *...+....1....+....2....+....3....+....4....+....5....+....6..*
   LABEL ON COLUMN CORPDATA.EMPLOYEE.SALARY IS
              'Yearly              Salary              (in dollars)'
 

This LABEL ON statement removes the column heading for SALARY:

   *...+....1....+....2....+....3....+....4....+....5....+....6..*
   LABEL ON COLUMN CORPDATA.EMPLOYEE.SALARY IS ''
 

This LABEL ON statement provides a DBCS column heading with two levels specified:

   *...+....1....+....2....+....3....+....4....+....5....+....6..*
   LABEL ON COLUMN CORPDATA.EMPLOYEE.SALARY IS
              '<AABBCCDD>          <EEFFGG>'
 

This LABEL ON statement provides the column text for the EDLEVEL column:

   *...+....1....+....2....+....3....+....4....+....5....+....6..*
   LABEL ON COLUMN CORPDATA.EMPLOYEE.EDLEVEL TEXT IS
      'Number of years of formal education'
 

 

Parent topic:

Data definition language

 

Related reference


LABEL