126 lines
6.5 KiB
HTML
126 lines
6.5 KiB
HTML
|
<?xml version="1.0" encoding="UTF-8"?>
|
|||
|
<!DOCTYPE html
|
|||
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|||
|
<html lang="en-us" xml:lang="en-us">
|
|||
|
<head>
|
|||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2005" />
|
|||
|
<meta name="DC.rights.owner" content="(C) Copyright IBM Corporation 2005" />
|
|||
|
<meta name="security" content="public" />
|
|||
|
<meta name="Robots" content="index,follow" />
|
|||
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
|||
|
<meta name="DC.Type" content="task" />
|
|||
|
<meta name="DC.Title" content="Use the LABEL ON statement" />
|
|||
|
<meta name="DC.Relation" scheme="URI" content="rzatcgetstartsql.htm" />
|
|||
|
<meta name="DC.Format" content="XHTML" />
|
|||
|
<meta name="DC.Identifier" content="rzatclabelon" />
|
|||
|
<meta name="DC.Language" content="en-us" />
|
|||
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|||
|
<!-- US Government Users Restricted Rights -->
|
|||
|
<!-- Use, duplication or disclosure restricted by -->
|
|||
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|||
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
|||
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
|||
|
<title>Use the LABEL ON statement</title>
|
|||
|
</head>
|
|||
|
<body id="rzatclabelon"><a name="rzatclabelon"><!-- --></a>
|
|||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|||
|
<h1 class="topictitle1">Use the LABEL ON statement</h1>
|
|||
|
<div><div class="section">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.<p>To change the labels for your columns, follow these steps:</p>
|
|||
|
</div>
|
|||
|
<ol><li class="stepexpand"><span>Enter <kbd class="userinput">LABEL ON COLUMN</kbd> on the Enter SQL Statements
|
|||
|
display.</span></li>
|
|||
|
<li class="stepexpand"><span>Press F4 (Prompt). The following display appears:</span> <div class="p"><pre class="screen"> Specify LABEL ON Statement
|
|||
|
|
|||
|
Type choices, press Enter.
|
|||
|
|
|||
|
Label on . . . . 2 1=Table or view
|
|||
|
2=Column
|
|||
|
3=Package
|
|||
|
4=Alias
|
|||
|
|
|||
|
Table or view INVENTORY_LIST______ Name, F4 for list
|
|||
|
Collection . . SAMPLECOLL__ Name, F4 for list
|
|||
|
|
|||
|
Option . . . . . 1 1=Column heading
|
|||
|
2=Text
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
F3=Exit F4=Prompt F5=Refresh F12=Cancel F20=Display full names
|
|||
|
F21=Display statement</pre>
|
|||
|
</div>
|
|||
|
</li>
|
|||
|
<li class="stepexpand"><span>Type in the name of the table and schema containing the columns
|
|||
|
for which you want to add labels.</span></li>
|
|||
|
<li class="stepexpand"><span>Press Enter. The following display is shown, prompting you for
|
|||
|
each of the columns in the table.</span> <div class="p"><pre class="screen"> Specify LABEL ON Statement
|
|||
|
|
|||
|
Type information, press Enter.
|
|||
|
|
|||
|
Column Heading
|
|||
|
Column ....+....1....+....2....+....3....+....4....+....5....
|
|||
|
ITEM_NUMBER <strong>'ITEM NUMBER'</strong>___________________________
|
|||
|
ITEM_NAME <strong>'ITEM NAME'</strong>_____________________________
|
|||
|
UNIT_COST <strong>'UNIT COST'</strong>_____________________________
|
|||
|
QUANTITY_ON_HAND <strong>'QUANTITY ON HAND'</strong>_________
|
|||
|
LAST_ORDER_DATE <strong>'LAST ORDER DATE'</strong>_________
|
|||
|
ORDER_QUANTITY <strong>'NUMBER ORDERED'</strong>__________________________
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
Bottom
|
|||
|
F3=Exit F5=Refresh F6=Insert line F10=Copy line F12=Cancel
|
|||
|
F14=Delete line F19=Display system column names F24=More keys
|
|||
|
|
|||
|
</pre>
|
|||
|
</div>
|
|||
|
</li>
|
|||
|
<li class="stepexpand"><span>Type the column headings for each of the columns. Column headings
|
|||
|
are defined in 20 character sections. Each section is displayed
|
|||
|
on a different line when showing the output of a SELECT statement. The ruler
|
|||
|
across the top of the column heading entry area can be used to easily space
|
|||
|
the headings correctly. </span></li>
|
|||
|
<li class="stepexpand"><span>Press Enter.</span></li>
|
|||
|
</ol>
|
|||
|
<div class="section">The following message indicates that the LABEL ON statement was successful:<pre>LABEL ON for INVEN00001 in SAMPLECOLL completed.</pre>
|
|||
|
</div>
|
|||
|
<div class="section">The table name in the message is the system table name for this table,
|
|||
|
not the name that was actually specified in the statement. <span class="keyword">DB2 Universal Database™ for iSeries™</span> 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 <a href="../db2/rbafzmst02.htm">SQL Reference</a> topic.<div class="note"><span class="notetitle">Note:</span> The <samp class="codeph">LABEL
|
|||
|
ON</samp> statement can also be typed in directly on the Enter SQL statements
|
|||
|
display as follows:<pre><strong>LABEL ON</strong> SAMPLECOLL.INVENTORY_LIST
|
|||
|
(ITEM_NUMBER <strong>IS</strong> ’ITEM NUMBER ’,
|
|||
|
ITEM_NAME <strong>IS</strong> ’ITEM NAME ’,
|
|||
|
UNIT_COST <strong>IS</strong> ’UNIT COST ’,
|
|||
|
QUANTITY_ON_HAND <strong>IS</strong> ’QUANTITY ON HAND ’,
|
|||
|
LAST_ORDER_DATE <strong>IS</strong> ’LAST ORDER DATE ’,
|
|||
|
ORDER_QUANTITY <strong>IS</strong> ’NUMBER ORDERED ’)</pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div>
|
|||
|
<div class="familylinks">
|
|||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzatcgetstartsql.htm" title="This topic describes how to create and work with schemas, tables, and views using SQL statements in interactive SQL.">Get started with SQL</a></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</body>
|
|||
|
</html>
|