158 lines
7.6 KiB
HTML
158 lines
7.6 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="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="reference" />
|
||
|
<meta name="DC.Title" content="Example: Use the list selection function" />
|
||
|
<meta name="abstract" content="The following example shows you how to use the list function to build a SELECT statement." />
|
||
|
<meta name="description" content="The following example shows you how to use the list function to build a SELECT statement." />
|
||
|
<meta name="DC.subject" content="examples, list function in interactive SQL" />
|
||
|
<meta name="keywords" content="examples, list function in interactive SQL" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafyuselistselect.htm" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="rbafylistselect1" />
|
||
|
<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>Example: Use the list selection function</title>
|
||
|
</head>
|
||
|
<body id="rbafylistselect1"><a name="rbafylistselect1"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Example: Use the list selection function</h1>
|
||
|
<div><p>The following example shows you how to use the list function to
|
||
|
build a SELECT statement.</p>
|
||
|
<div class="section"><p>Assume you have:</p>
|
||
|
</div>
|
||
|
<div class="section"> <ul><li>Just entered interactive SQL by typing <samp class="codeph">STRSQL</samp> on an <span class="keyword">i5/OS™</span> command line.</li>
|
||
|
<li>Made no list selections or entries.</li>
|
||
|
<li>Selected *SQL for the naming convention.</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div class="section"> <div class="note"><span class="notetitle">Note:</span> The example shows lists that are not on your server. They
|
||
|
are used as an example only.</div>
|
||
|
</div>
|
||
|
<div class="section"><p>Begin using SQL statements: </p>
|
||
|
</div>
|
||
|
<div class="section"> <ol><li>Type <samp class="codeph">SELECT</samp> on the first statement entry line.</li>
|
||
|
<li>Type <samp class="codeph">FROM</samp> on the second statement entry line.</li>
|
||
|
<li>Leave the cursor positioned after <samp class="codeph">FROM</samp>. <pre class="screen"> Enter SQL Statements
|
||
|
|
||
|
Type SQL statement, press Enter.
|
||
|
===> SELECT
|
||
|
FROM <strong>_</strong>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</pre>
|
||
|
</li>
|
||
|
<li>Press F17=Select tables to obtain a list of tables, because you want the
|
||
|
table name to follow <samp class="codeph">FROM</samp>. <p>Instead of a list of tables
|
||
|
appearing as you expected, a list of collections appears (the Select and Sequence
|
||
|
collections display). You have just entered the SQL session and have not selected
|
||
|
a schema to work with.</p>
|
||
|
</li>
|
||
|
<li>Type a 1 in the <em>Seq</em> column next to YOURCOLL2 schema. <pre class="screen"> Select and Sequence Collections
|
||
|
|
||
|
|
||
|
Type sequence numbers (1-999) to select collection, press Enter.
|
||
|
|
||
|
Seq Collection Type Text
|
||
|
YOURCOLL1 SYS Company benefits
|
||
|
1 YOURCOLL2 SYS Employee personal data
|
||
|
YOURCOLL3 SYS Job classifications/requirements
|
||
|
YOURCOLL4 SYS Company insurances
|
||
|
|
||
|
</pre>
|
||
|
</li>
|
||
|
<li>Press Enter. <p>The Select and Sequence Tables display appears, showing
|
||
|
the tables existing in the YOURCOLL2 schema.</p>
|
||
|
</li>
|
||
|
<li>Type a 1 in the <em>Seq</em> column next to PEOPLE table. <pre class="screen"> Select and Sequence Tables
|
||
|
|
||
|
Type sequence numbers (1-999) to select tables, press Enter.
|
||
|
|
||
|
Seq Table Collection Type Text
|
||
|
EMPLCO YOURCOLL2 TAB Employee company data
|
||
|
1 PEOPLE YOURCOLL2 TAB Employee personal data
|
||
|
EMPLEXP YOURCOLL2 TAB Employee experience
|
||
|
EMPLEVL YOURCOLL2 TAB Employee evaluation reports
|
||
|
EMPLBEN YOURCOLL2 TAB Employee benefits record
|
||
|
EMPLMED YOURCOLL2 TAB Employee medical record
|
||
|
EMPLINVST YOURCOLL2 TAB Employee investments record
|
||
|
</pre>
|
||
|
</li>
|
||
|
<li>Press Enter. <p>The Enter SQL Statements display appears again with the
|
||
|
table name, <samp class="codeph">YOURCOLL2.PEOPLE</samp>, inserted after <samp class="codeph">FROM</samp>.
|
||
|
The table name is qualified by the schema name in the *SQL naming convention.</p>
|
||
|
<pre class="screen"> Enter SQL Statements
|
||
|
|
||
|
Type SQL statement, press Enter.
|
||
|
===> SELECT
|
||
|
FROM YOURCOLL2.PEOPLE <strong>_</strong>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</pre>
|
||
|
</li>
|
||
|
<li>Position the cursor after <samp class="codeph">SELECT</samp>.</li>
|
||
|
<li>Press F18=Select columns to obtain a list of columns, because you want
|
||
|
the column name to follow <samp class="codeph">SELECT</samp>. <p>The Select and Sequence
|
||
|
Columns display appears, showing the columns in the PEOPLE table.</p>
|
||
|
</li>
|
||
|
<li>Type a 2 in the <em>Seq</em> column next to the <em>NAME</em> column.</li>
|
||
|
<li>Type a 1 in the <em>Seq</em> column next to the <em>SOCSEC</em> column. <pre class="screen"> Select and Sequence Columns
|
||
|
|
||
|
Type sequence numbers (1-999) to select columns, press Enter.
|
||
|
|
||
|
Seq Column Table Type Digits Length
|
||
|
2 NAME PEOPLE CHARACTER 6
|
||
|
EMPLNO PEOPLE CHARACTER 30
|
||
|
1 SOCSEC PEOPLE CHARACTER 11
|
||
|
STRADDR PEOPLE CHARACTER 30
|
||
|
CITY PEOPLE CHARACTER 20
|
||
|
ZIP PEOPLE CHARACTER 9
|
||
|
PHONE PEOPLE CHARACTER 20
|
||
|
</pre>
|
||
|
</li>
|
||
|
<li>Press Enter. <p>The Enter SQL Statements display appears again with <samp class="codeph">SOCSEC</samp>, <samp class="codeph">NAME</samp> appearing
|
||
|
after <samp class="codeph">SELECT</samp>.</p>
|
||
|
<pre class="screen"> Enter SQL Statements
|
||
|
|
||
|
Type SQL statement, press Enter.
|
||
|
===> SELECT SOCSEC, NAME
|
||
|
FROM YOURCOLL2.PEOPLE
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</pre>
|
||
|
</li>
|
||
|
<li>Press Enter. <p>The statement you created is now run.</p>
|
||
|
</li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
<div class="section"><p>Once you have used the list function, the values you selected
|
||
|
remain in effect until you change them or until you change the list of schemas
|
||
|
on the Change Session Attributes display.</p>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafyuselistselect.htm" title="The list selection function is available by pressing F4 on certain prompt displays, or F16, F17, or F18 on the Enter SQL Statements display.">Use the list selection function</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|