Creating descriptive labels using the LABEL ON statement

Sometimes a text description is useful for an object (such as a table or an index) or useful as column text or column headings. 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 an object or a column cannot be more than 50 bytes and the label for a column heading cannot be more than 60 bytes (blanks included). Here are the 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'