Using the LABEL ON statement
Normally, the column name is used as the column heading when the output of a SELECT statement is shown 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 name is descriptive, it is easier to read if
the column heading shows 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® for
i maintains
two names for tables with names longer than 10 characters.
Note: The
LABEL ON statement can also be typed 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 ')