Normally, the column name is used as the column heading when showing
the output of a SELECT statement in interactive SQL. By using the LABEL ON
statement, you can create a more descriptive label for the column name. Because
you run your examples in interactive SQL, you use the LABEL ON statement to
change the column headings. Even though the column names were descriptive,
it is easier to read if the column headings show each part of the name on
a single line. It also allows you to see more columns of data on a single
display.
To change the labels for your columns, follow these steps:
The following message indicates that the LABEL ON statement was successful:
LABEL ON for INVEN00001 in SAMPLECOLL completed.
The table name in the message is the system table name for this table,
not the name that was actually specified in the statement.
DB2 Universal Database™ for iSeries™ maintains
two names for tables with names longer than ten characters. For more information
about system table names, see the CREATE TABLE statement in the
SQL Reference topic.
Note: The
LABEL
ON statement can also be typed in directly on the Enter SQL statements
display as follows:
LABEL ON SAMPLECOLL.INVENTORY_LIST
(ITEM_NUMBER IS ’ITEM NUMBER ’,
ITEM_NAME IS ’ITEM NAME ’,
UNIT_COST IS ’UNIT COST ’,
QUANTITY_ON_HAND IS ’QUANTITY ON HAND ’,
LAST_ORDER_DATE IS ’LAST ORDER DATE ’,
ORDER_QUANTITY IS ’NUMBER ORDERED ’)