526 lines
36 KiB
HTML
526 lines
36 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="iSeries database frequently asked questions" />
|
||
|
<meta name="abstract" content="You can check the database FAQ for answers to your DB2 and Structured Query Language (SQL) questions. Topics in the FAQ include finding informative database resources, data sharing and migration, and several query topics." />
|
||
|
<meta name="description" content="You can check the database FAQ for answers to your DB2 and Structured Query Language (SQL) questions. Topics in the FAQ include finding informative database resources, data sharing and migration, and several query topics." />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzatekickoff.htm" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2004, 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2004, 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="rzatefaq" />
|
||
|
<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>iSeries database
|
||
|
frequently asked questions</title>
|
||
|
</head>
|
||
|
<body id="rzatefaq"><a name="rzatefaq"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">iSeries database
|
||
|
frequently asked questions</h1>
|
||
|
<div><p>You can check the database FAQ for answers to your DB2<sup>®</sup> and Structured
|
||
|
Query Language (SQL) questions. Topics in the FAQ include finding informative
|
||
|
database resources, data sharing and migration, and several query topics. </p>
|
||
|
<div class="section" id="rzatefaq__question1"><a name="rzatefaq__question1"><!-- --></a><h4 class="sectiontitle">DB2 Universal Database™ for iSeries™ fundamentals</h4><ol><li><a href="#rzatefaq__basic1">What is DB2 UDB for iSeries? </a></li>
|
||
|
<li><a href="#rzatefaq__basic2">Is the iSeries server part of the DB2 family?</a></li>
|
||
|
<li><a href="#rzatefaq__basic3">How does DB2 UDB for iSeries relate to other DB2 products?</a></li>
|
||
|
<li><a href="#rzatefaq__basic4">What level of DB2 do I have?</a></li>
|
||
|
<li><a href="#rzatefaq__basic5">Does iSeries provide any sample databases?</a></li>
|
||
|
<li><a href="#rzatefaq__basic6">How do I install DB2?</a></li>
|
||
|
<li><a href="#rzatefaq__basic7">How do I authorize users to DB2? </a></li>
|
||
|
<li><a href="#rzatefaq__basic8">How do I administer DB2 UDB for iSeries?</a></li>
|
||
|
<li><a href="#rzatefaq__basic9">Can I assign my own long and short
|
||
|
names to tables and columns?</a></li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
<div class="section" id="rzatefaq__question2"><a name="rzatefaq__question2"><!-- --></a><h4 class="sectiontitle">Database resources in the iSeries Information
|
||
|
Center</h4><ol><li><a href="#rzatefaq__resource1">Where are the DB2 manuals located?</a></li>
|
||
|
<li><a href="#rzatefaq__resource2">I'm having trouble printing
|
||
|
a PDF. What should I do?</a></li>
|
||
|
<li><a href="#rzatefaq__resource3">What other resources exist
|
||
|
to help me use the information center?</a></li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
<div class="section" id="rzatefaq__question3"><a name="rzatefaq__question3"><!-- --></a><h4 class="sectiontitle">Data sharing and database migration</h4><ol><li><a href="#rzatefaq__data1">How do I move data between DB2 and
|
||
|
other systems?</a></li>
|
||
|
<li><a href="#rzatefaq__data2">How do I migrate existing databases
|
||
|
to DB2 UDB
|
||
|
for iSeries?</a></li>
|
||
|
<li><a href="#rzatefaq__data3">Can I store XML data in DB2 UDB for iSeries?</a></li>
|
||
|
<li><a href="#rzatefaq__data4">Can I connect to a DB2 database that
|
||
|
is on a non-iSeries server from my iSeries server?</a></li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
<div class="section" id="rzatefaq__question4"><a name="rzatefaq__question4"><!-- --></a><h4 class="sectiontitle">Query for iSeries</h4><ol><li><a href="#rzatefaq__qi1">How can I find all the queries that
|
||
|
accessed a specific file?</a></li>
|
||
|
<li><a href="#rzatefaq__qi2">Does IBM<sup>®</sup> provide any graphical query interfaces
|
||
|
for the iSeries server?</a></li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
<div class="section" id="rzatefaq__question5"><a name="rzatefaq__question5"><!-- --></a><h4 class="sectiontitle">SQL-based queries</h4><ol><li><a href="#rzatefaq__qsql1">How can I join two members of the
|
||
|
same table?</a></li>
|
||
|
<li><a href="#rzatefaq__qsql2">How can I run SQL statements from
|
||
|
a text file?</a></li>
|
||
|
<li><a href="#rzatefaq__qsql3">How can I write an SQL query that
|
||
|
lists a set of detail records with a total at the bottom?</a></li>
|
||
|
<li><a href="#rzatefaq__qsql4">How can I select rows based on
|
||
|
the current date in numeric or character fields?</a></li>
|
||
|
<li><a href="#rzatefaq__qsql5">Why is my query performing
|
||
|
poorly after an upgrade to a newer release of i5/OS™?</a></li>
|
||
|
<li><img src="./delta.gif" alt="Start of change" /><a href="#rzatefaq__qsql6">Can I create an alias
|
||
|
on a server for a table, view, or physical file that is on another server?</a><img src="./deltaend.gif" alt="End of change" /></li>
|
||
|
<li><img src="./delta.gif" alt="Start of change" /><a href="#rzatefaq__qsql7">When the first member
|
||
|
of a multimember database file has the same name as the file, it is the only
|
||
|
member of the file that you can access using SQL. How can I access another
|
||
|
member using SQL?</a><img src="./deltaend.gif" alt="End of change" /></li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
<div class="section" id="rzatefaq__question6"><a name="rzatefaq__question6"><!-- --></a><h4 class="sectiontitle">SQL messages</h4><ol><li><a href="#rzatefaq__message1">When are SQL messages displayed?</a></li>
|
||
|
<li><a href="#rzatefaq__message2">What does SQL0901 message code
|
||
|
mean?</a></li>
|
||
|
<li><a href="#rzatefaq__message3">Where can I find a listing of
|
||
|
SQL messages and SQL codes?</a></li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
<div class="section" id="rzatefaq__question7"><a name="rzatefaq__question7"><!-- --></a><h4 class="sectiontitle">SQL packages</h4><ol><li><a href="#rzatefaq__package1">What are SQL packages?</a></li>
|
||
|
<li><a href="#rzatefaq__package2">What are the advantages of using
|
||
|
SQL packages?</a></li>
|
||
|
<li><a href="#rzatefaq__package3">What data is stored in an SQL
|
||
|
package?</a></li>
|
||
|
<li><a href="#rzatefaq__package4">How can I tell what statements
|
||
|
are in an SQL package?</a></li>
|
||
|
<li><a href="#rzatefaq__package5">How can I tell if the SQL package
|
||
|
is being used?</a></li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
<div class="section" id="rzatefaq__question8"><a name="rzatefaq__question8"><!-- --></a><h4 class="sectiontitle">Stored procedures</h4><ol><li><a href="#rzatefaq__store1">How can I view the contents of
|
||
|
a result set and the output parameters from a stored procedure call?</a></li>
|
||
|
<li><a href="#rzatefaq__store2">Can existing RPG or COBOL programs
|
||
|
be used as stored procedures?</a></li>
|
||
|
<li><a href="#rzatefaq__store3">I do a CREATE PROCEDURE that contains
|
||
|
SQL statements that reference user-defined functions. Before calling the procedure,
|
||
|
I do a SET PATH so the functions are found. Why aren't the functions found
|
||
|
when I call the procedure?</a></li>
|
||
|
<li><a href="#rzatefaq__store4">How do I find out if a
|
||
|
stored procedure exists, in what library it exists, and what the attributes
|
||
|
of the stored procedure are?</a></li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
<div class="section" id="rzatefaq__question9"><a name="rzatefaq__question9"><!-- --></a><h4 class="sectiontitle">Triggers</h4><ol><li><a href="#rzatefaq__trigger1">What is a trigger?</a></li>
|
||
|
<li><a href="#rzatefaq__trigger2">Why does my trigger program
|
||
|
not work after upgrading i5/OS?</a></li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
<div class="section" id="rzatefaq__basic"><a name="rzatefaq__basic"><!-- --></a><h4 class="sectiontitle">DB2 Universal Database for iSeries fundamentals</h4><ol><li id="rzatefaq__basic1"><a name="rzatefaq__basic1"><!-- --></a><span><strong>What is DB2 UDB for iSeries?</strong></span><p>DB2 UDB for iSeries is
|
||
|
the relational database manager that is fully integrated on your iSeries server.
|
||
|
Because it is integrated, DB2 UDB for iSeries is easy to use and manage. DB2 UDB
|
||
|
for iSeries also
|
||
|
provides functions such as triggers, stored procedures, and dynamic bitmapped
|
||
|
indexing that serve a wide variety of application types. These applications
|
||
|
range from traditional host-based applications to client/server solutions
|
||
|
to business intelligence applications.</p>
|
||
|
<p>The history of DB2 UDB for iSeries began
|
||
|
in the late 1980s with the integration of a fully relational, though nameless,
|
||
|
database on the first AS/400<sup>®</sup> systems. In 1995, this database joined the DB2 brand,
|
||
|
adopting the name DB2/400. In 1999, the DB2 UDB branding was added.</p>
|
||
|
<p>As an
|
||
|
interface to DB2 UDB
|
||
|
for iSeries,
|
||
|
the DB2 Query
|
||
|
Manager and SQL Development Kit for iSeries adds an interactive query and
|
||
|
report writing interface, as well as precompilers and tools to assist in writing
|
||
|
SQL application programs in high-level programming languages. Conforming to
|
||
|
the industry standard SQL, the SQL implementation for <span class="keyword">i5/OS</span> allows you to define, manipulate, query, and
|
||
|
control access to your iSeries data. It works equally well with <span class="keyword">i5/OS</span> files and
|
||
|
SQL tables.</p>
|
||
|
<p><a href="#rzatefaq__question1">Back
|
||
|
to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__basic2"><a name="rzatefaq__basic2"><!-- --></a><span><strong>Is the iSeries server part of the DB2 family?</strong></span><p>Yes. DB2 UDB
|
||
|
for iSeries is
|
||
|
the newest member of the DB2 UDB product line, which also includes DB2 UDB and DB2
|
||
|
Universal Database™ for zSeries<sup>®</sup>. DB2 UDB, the founding member of the product
|
||
|
line, is the single product available across all UNIX<sup>®</sup>, Windows NT<sup>®</sup>, and OS/2<sup>®</sup> operating
|
||
|
systems.</p>
|
||
|
<p><a href="#rzatefaq__question1">Back
|
||
|
to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__basic3"><a name="rzatefaq__basic3"><!-- --></a><span><strong>How does DB2 UDB for iSeries relate to other DB2 products?</strong></span><p>Each
|
||
|
member of the DB2 UDB
|
||
|
product line has its own unique code-base, functions, and different SQL syntax.
|
||
|
There is, however, technology sharing across the DB2 UDB brand members. To learn about the
|
||
|
relationships between the DB2 UDB products, see the following information:</p>
|
||
|
<ul><li><a href="http://www-1.ibm.com/servers/enable/site/db2/db2common.html" target="_blank">DB2 Universal Database: Selected Common
|
||
|
SQL Features for Developers of Portable SQL Applications</a><img src="www.gif" alt="Link outside information center" /> contains information about the SQL features available
|
||
|
on the DB2 UDB
|
||
|
products.</li>
|
||
|
<li><a href="http://www-1.ibm.com/servers/enable/site/education/ibo/record.html?db2400" target="_blank">What Does DB2 UDB on the iSeries Really Mean?</a><img src="www.gif" alt="Link outside information center" /> explains the position of DB2 UDB for iSeries in the DB2 family, with details about functionality.</li>
|
||
|
<li><a href="http://www-1.ibm.com/servers/enable/site/db2/porting.html" target="_blank">DB2 Porting Information</a><img src="www.gif" alt="Link outside information center" /> provides guides to help you move data between DB2 UDB
|
||
|
products. The porting guides also provide a brief history of the DB2 UDB brand.</li>
|
||
|
</ul>
|
||
|
<p><a href="#rzatefaq__question1">Back to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__basic4"><a name="rzatefaq__basic4"><!-- --></a><span><strong>What level of DB2 do I have?</strong></span><p>If you are using
|
||
|
an iSeries server,
|
||
|
you have DB2 UDB
|
||
|
for iSeries.
|
||
|
The level of DB2 UDB
|
||
|
for iSeries is
|
||
|
based on the <span class="keyword">i5/OS</span> operating
|
||
|
system, and is independent of the DB2 versioning scheme. Because DB2 UDB for iSeries is
|
||
|
included with the <span class="keyword">i5/OS</span> operating
|
||
|
system, the version, release, and modification level of DB2 is the same
|
||
|
as that of your operating system. This is typically expressed as VxRyMz, where
|
||
|
x is the version, y is the release, and m is the modification. If you do not
|
||
|
know what version, release, and modification of <span class="keyword">i5/OS</span> you have, use the following steps:</p>
|
||
|
<ol type="a"><li>In iSeries Navigator,
|
||
|
right click your server.</li>
|
||
|
<li>Select <span class="uicontrol">Properties</span>.</li>
|
||
|
<li>If it is not already selected, click the <span class="uicontrol">General </span> tab.</li>
|
||
|
</ol>
|
||
|
<p><a href="#rzatefaq__question1">Back to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__basic5"><a name="rzatefaq__basic5"><!-- --></a><span><strong>Does the iSeries server provide any sample databases?</strong></span><p>Yes.
|
||
|
You can find the sample tables and the system-provided stored procedure to
|
||
|
create them in <a href="../sqlp/rbafysamptblx.htm">DB2 UDB
|
||
|
for iSeries sample
|
||
|
tables</a> of the SQL programming topic.</p>
|
||
|
<p><a href="#rzatefaq__question1">Back to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__basic6"><a name="rzatefaq__basic6"><!-- --></a><span><strong>How do I install DB2?</strong></span><p>You don't need to
|
||
|
install DB2.
|
||
|
It is shipped as a part of i5/OS at every release.</p>
|
||
|
<p><a href="#rzatefaq__question1">Back to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__basic7"><a name="rzatefaq__basic7"><!-- --></a><span><strong>How do I authorize users to DB2?</strong></span><p>DB2 object access
|
||
|
can be controlled using SQL GRANT and REVOKE statements along with i5/OS security
|
||
|
interfaces. See <a href="../dbp/rbafosecuc.htm">Secure
|
||
|
a database</a> in the Database programming topic. iSeries Navigator can also be used to
|
||
|
authorize users. For more information, see <a href="../dbp/rbafoautuon.htm">Authorize a user or group using iSeries Navigator</a>.</p>
|
||
|
<p><a href="#rzatefaq__question1">Back to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__basic8"><a name="rzatefaq__basic8"><!-- --></a><span><strong>How do I administer DB2 UDB for iSeries?</strong></span><p>You
|
||
|
can administer DB2 UDB
|
||
|
for iSeries using iSeries Navigator.
|
||
|
Within iSeries Navigator
|
||
|
there is a tool for working with databases. You can work either from a traditional
|
||
|
tree view of you database, or from a visual representation of the database
|
||
|
objects called Database Navigator. For details about using Database Navigator,
|
||
|
see <a href="../rzatc/rzatcdbmap.htm">Map your database
|
||
|
using Database Navigator maps</a>.</p>
|
||
|
<p><a href="#rzatefaq__question1">Back to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__basic9"><a name="rzatefaq__basic9"><!-- --></a><span><strong></strong><strong>Can I assign my own long and short names to
|
||
|
tables and columns?</strong></span><p>Yes. See <a href="http://www-1.ibm.com/servers/eserver/iseries/db2/longsqltable.htm" target="_blank">Co-existing with "long" SQL table and column names</a><img src="www.gif" alt="Link outside information center" /> for instructions.</p>
|
||
|
<p><a href="#rzatefaq__question1">Back to questions</a></p>
|
||
|
</li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
<div class="section" id="rzatefaq__resource"><a name="rzatefaq__resource"><!-- --></a><h4 class="sectiontitle">Database resources in the iSeries Information
|
||
|
Center</h4><ol><li id="rzatefaq__resource1"><a name="rzatefaq__resource1"><!-- --></a><span><strong>Where are the DB2 manuals located?</strong></span><p>The Softcopy
|
||
|
Library was integrated into the iSeries Information Center in V5R1. You
|
||
|
can find database manuals by following the (PDFs) link in the information
|
||
|
center navigation bar under the Database topic.</p>
|
||
|
<p><a href="#rzatefaq__question2">Back to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__resource2"><a name="rzatefaq__resource2"><!-- --></a><span><strong>I'm having trouble printing a PDF. What should I
|
||
|
do?</strong></span><p>It is recommended that you save PDF files locally for ease
|
||
|
in viewing and printing. To save the PDF, follow these steps:</p>
|
||
|
<ol type="a"><li>Right-click the PDF in your browser.</li>
|
||
|
<li>Click <span class="uicontrol">Save Target As...</span></li>
|
||
|
<li>Navigate to the directory in which to save the PDF. </li>
|
||
|
<li>Click <span class="uicontrol">Save</span>.</li>
|
||
|
</ol>
|
||
|
<p><a href="#rzatefaq__question2">Back to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__resource3"><a name="rzatefaq__resource3"><!-- --></a><span><strong>What other resources exist to help me use the information
|
||
|
center?</strong></span><p>See the <a href="../rzahg/rzahgicfaq.htm">Frequently
|
||
|
asked questions about the information center</a> topic. This FAQ contains
|
||
|
tips that make using the information center easier. You can also find help
|
||
|
by clicking the help button in the upper right of your screen.</p>
|
||
|
<p><a href="#rzatefaq__question2">Back to questions</a></p>
|
||
|
</li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
<div class="section" id="rzatefaq__data"><a name="rzatefaq__data"><!-- --></a><h4 class="sectiontitle">Data sharing and database migration</h4><ol><li id="rzatefaq__data1"><a name="rzatefaq__data1"><!-- --></a><span><strong>How do I move data between DB2 and other systems?</strong></span><p>You can
|
||
|
use the <a href="../cl/cpyfrmimpf.htm">Copy From Import File
|
||
|
(CPYFRMIMPF)</a> and <a href="../cl/cpytoimpf.htm">Copy
|
||
|
To Import File (CPYTOIMPF)</a> commands to import (load) or export (unload)
|
||
|
data from and to the iSeries server. See the <a href="../rzahf/rzahfimportexportdata.htm">Import
|
||
|
and export data between systems</a> topic for instructions.</p>
|
||
|
<p><a href="#rzatefaq__question3">Back to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__data2"><a name="rzatefaq__data2"><!-- --></a><span><strong>How do I migrate existing databases to DB2 UDB for iSeries?</strong></span><p>IBM provides
|
||
|
several guides to help you move data into DB2 UDB for iSeries from other databases, such as
|
||
|
Oracle and SQL Server. See <a href="http://www-1.ibm.com/servers/enable/site/db2/porting.html" target="_blank">DB2 Porting Information</a><img src="www.gif" alt="Link outside information center" /> for the guides. </p>
|
||
|
<p><a href="#rzatefaq__question3">Back to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__data3"><a name="rzatefaq__data3"><!-- --></a><span><strong>Can I store XML data in DB2 UDB for iSeries?</strong></span><p>Yes. See the <a href="../books/sc189179.pdf" target="_blank">XML Extender Administration
|
||
|
and Programming</a><img src="wbpdf.gif" alt="Link to PDF" /> manual
|
||
|
for tutorials on how to set up a database using provided sample data, how
|
||
|
to map SQL data to an XML document, how to store XML documents in the database,
|
||
|
and how to search and extract data from the XML documents. </p>
|
||
|
<p><a href="#rzatefaq__question3">Back to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__data4"><a name="rzatefaq__data4"><!-- --></a><span><strong>Can I connect to a DB2 database that is on a non-iSeries server
|
||
|
from my iSeries server?</strong></span><p>Yes.
|
||
|
You can learn more in <a href="../ddp/rbal1xplat.htm">User
|
||
|
FAQs</a> of the Distributed database programming topic.</p>
|
||
|
<p><a href="#rzatefaq__question3">Back to questions</a></p>
|
||
|
</li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
<div class="section" id="rzatefaq__qi"><a name="rzatefaq__qi"><!-- --></a><h4 class="sectiontitle">Query for iSeries</h4><ol><li id="rzatefaq__qi1"><a name="rzatefaq__qi1"><!-- --></a><span><strong>How can I find all the queries that accessed a specific
|
||
|
file?</strong></span><p>You can follow these steps to produce a report of all the
|
||
|
queries containing the file name:</p>
|
||
|
<ol type="a"><li>Copy the code in <a href="rzatefindqueryex.htm#examplefindingthequeriesthataccessedaspecificfile">Example: Find the queries that accessed a specific file</a>,
|
||
|
replacing &LIBRARY and &FILE with your library and file names.</li>
|
||
|
<li>Create the command FFINQ using the <a href="../cl/crtcmd.htm">Create
|
||
|
Command (CRTCMD)</a> command.</li>
|
||
|
<li>Specify GETQRYPRM as the program to process command.</li>
|
||
|
</ol>
|
||
|
<p><a href="#rzatefaq__question4">Back to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__qi2"><a name="rzatefaq__qi2"><!-- --></a><span><strong>Does IBM provide any graphical query interfaces for the iSeries server?</strong></span><p>The graphical query interface software provided for iSeries includes <a href="http://www-4.ibm.com/software/data/qmf" target="_blank"> DB2 Query
|
||
|
Management Facility</a><img src="www.gif" alt="Link outside information center" /> and <a href="http://www-306.ibm.com/software/data/db2imstools/db2tools/db2wqt" target="_blank">DB2 Web Query Tool</a><img src="www.gif" alt="Link outside information center" />. </p>
|
||
|
<p><a href="#rzatefaq__question4">Back
|
||
|
to questions</a></p>
|
||
|
</li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
<div class="section" id="rzatefaq__qsql"><a name="rzatefaq__qsql"><!-- --></a><h4 class="sectiontitle">SQL-based queries</h4><ol><li id="rzatefaq__qsql1"><a name="rzatefaq__qsql1"><!-- --></a><span><strong>How can I join two members of the same table?</strong></span><p>You can join two members of the same table by creating an
|
||
|
alias for one of the members and joining them using the alias. To create an
|
||
|
alias using SQL, see the <a href="../sqlp/rbafycreatingalias.htm">Create
|
||
|
and use ALIAS names</a> or <a href="../rzahf/rzahfcreatedbotable.htm">Create database objects</a> topic.</p>
|
||
|
<p><a href="#rzatefaq__question5">Back to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__qsql2"><a name="rzatefaq__qsql2"><!-- --></a><span><strong>How can I run SQL statements from a text file?</strong></span><p>You can run SQL statements from a text file using the <a href="../cl/runsqlstm.htm">Run SQL Statements (RUNSQLSTM)</a> command.
|
||
|
Or, you can use Run SQL Scripts from iSeries Navigator to run a text file
|
||
|
on your PC or in the integrated file system. See <a href="../rzatc/rzatcrunscript.htm">Query
|
||
|
your database using the Run SQL Scripts interface</a>.</p>
|
||
|
<p><a href="#rzatefaq__question5">Back to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__qsql3"><a name="rzatefaq__qsql3"><!-- --></a><span><strong>How can I write an SQL query that lists a set of detail
|
||
|
rows with a total at the bottom?</strong></span><div class="p">You can use a <tt>UNION</tt> operation
|
||
|
to append the total as a row at the end of the list of items, as illustrated
|
||
|
in the following example: <pre><strong>SELECT</strong> 'ITEM' <strong>AS</strong> ROWTYPE, PARTID, PRICE
|
||
|
<strong>FROM</strong> PART
|
||
|
<strong>UNION</strong>
|
||
|
<strong>SELECT</strong> 'TOTAL' <strong>AS</strong> ROWTYPE, 0 <strong>AS</strong> PARTID, <strong>SUM</strong>( PRICE ) <strong>AS</strong> PRICE
|
||
|
<strong>FROM</strong> PART
|
||
|
<strong>ORDER BY</strong> ROWTYPE, PARTID</pre>
|
||
|
</div>
|
||
|
<p>To make sure that the total
|
||
|
row is at the end of the result set, you must include the <tt>Order By</tt> clause.</p>
|
||
|
<p><a href="#rzatefaq__question5">Back to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__qsql4"><a name="rzatefaq__qsql4"><!-- --></a><span><strong>How can I select rows based on the current date in numeric
|
||
|
or character fields?</strong></span><p>The SQL <tt>CurDate</tt> function returns
|
||
|
a date value, which cannot be directly compared to a number or an unformatted
|
||
|
character value. You must do some conversion before the comparison. Use SQL
|
||
|
functions to get the year, month, and day of the date as integers, and then
|
||
|
create a numeric date in the form YYYYMMDD. See the code in <a href="rzatecurdateex.htm#rzatecurdateex">Example: Select records based on the current date</a>.</p>
|
||
|
<p><a href="#rzatefaq__question5">Back to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__qsql5"><a name="rzatefaq__qsql5"><!-- --></a><span><strong>Why is my query performing poorly after an upgrade to
|
||
|
a newer release of <span class="keyword">i5/OS</span>?</strong></span><p>There can be some query performance problems if you recently
|
||
|
upgraded from V4R4 to a newer release or version. See <a href="http://www.ibm.com/support/docview.wss?uid=nas1f865c1d0f9fa573f86256a5b0049ffc1" target="_blank"> IBM DB2 UDB Query Performance Behavior Changes Since R440</a><img src="www.gif" alt="Link outside information center" /> for a possible
|
||
|
solution.</p>
|
||
|
<p><a href="#rzatefaq__question5">Back
|
||
|
to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__qsql6"><a name="rzatefaq__qsql6"><!-- --></a><img src="./delta.gif" alt="Start of change" /><span><strong>Can I create an alias on a server for a
|
||
|
table, view, or physical file that is on another server?</strong></span><p>No. When
|
||
|
you create an alias, make sure that the table, view, or physical file you
|
||
|
create it for is on the current server. For more information, see <a href="../db2/rbafzmsthcalias.htm">CREATE ALIAS</a>, with some syntax examples.</p>
|
||
|
<p><a href="#rzatefaq__question5">Back to questions</a></p>
|
||
|
<img src="./deltaend.gif" alt="End of change" /></li>
|
||
|
<li id="rzatefaq__qsql7"><a name="rzatefaq__qsql7"><!-- --></a><img src="./delta.gif" alt="Start of change" /><span><strong>When the first member of a multimember
|
||
|
database file has the same name as the file, it is the only member of the
|
||
|
file that you can access using SQL. How can I access another member using
|
||
|
SQL?</strong></span><p>You can create an alias to point at the first member you want
|
||
|
to access.</p>
|
||
|
<div class="p">Example 2: Create an alias named SALES_JANUARY on the JANUARY
|
||
|
member of the SALES table. The sales table has 12 members (one for each month
|
||
|
of the year).<pre>CREATE ALIAS SALES_JANUARY
|
||
|
FOR SALES(JANUARY)</pre>
|
||
|
For the complete example in the SQL reference,
|
||
|
see <a href="../db2/rbafzmsthcalias.htm">CREATE ALIAS</a>.</div>
|
||
|
<p><a href="#rzatefaq__question5">Back to questions</a></p>
|
||
|
<img src="./deltaend.gif" alt="End of change" /></li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
<div class="section" id="rzatefaq__message"><a name="rzatefaq__message"><!-- --></a><h4 class="sectiontitle">SQL messages</h4><ol><li id="rzatefaq__message1"><a name="rzatefaq__message1"><!-- --></a><span><strong>When are SQL messages displayed?</strong></span><p>SQL messages
|
||
|
are displayed when a DB2 UDB for iSeries returns an error or code to the
|
||
|
application that uses it. The message text is displayed or logged at run time.</p>
|
||
|
<p><a href="#rzatefaq__question6">Back to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__message2"><a name="rzatefaq__message2"><!-- --></a><span><strong>What does the SQL0901 message mean?</strong></span><p>SQL0901:
|
||
|
An SQL system error has occurred. This is the general message for all errors.
|
||
|
For more information about SQL0901, see the <a href="../rzala/rzalakickoff.htm">SQL
|
||
|
messages and codes</a> topic.</p>
|
||
|
<p><a href="#rzatefaq__question6">Back to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__message3"><a name="rzatefaq__message3"><!-- --></a><span><strong>Where can I find a list of SQL messages and SQL codes?</strong></span><p>You
|
||
|
can find a complete list of SQL messages and codes in the <a href="../rzala/rzalakickoff.htm">SQL messages and codes</a> topic. Or use <a href="../rzala/rzalafinder.htm">SQL message finder</a>.</p>
|
||
|
<p>An
|
||
|
application can also send the SQL message corresponding to any SQLCODE to
|
||
|
the job log by specifying the message ID and the replacement text on the CL
|
||
|
commands <a href="../cl/rtvmsg.htm">Retrieve Message (RTVMSG)</a>, <a href="../cl/sndpgmmsg.htm">Send Program Message (SNDPGMMSG)</a>,
|
||
|
and <a href="../cl/sndusrmsg.htm">Send User Message (SNDUSRMSG)</a>.</p>
|
||
|
<p><a href="#rzatefaq__question6">Back to questions</a></p>
|
||
|
</li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
<div class="section" id="rzatefaq__package"><a name="rzatefaq__package"><!-- --></a><h4 class="sectiontitle">SQL packages</h4><ol><li id="rzatefaq__package1"><a name="rzatefaq__package1"><!-- --></a><span><strong>What are SQL packages?</strong></span><p>SQL packages are
|
||
|
permanent objects that are used to store information related to prepared SQL
|
||
|
statements. They are used by open database connectivity (ODBC) support when
|
||
|
the Extended Dynamic box is checked on a data source. They are also used by
|
||
|
applications that use an API.</p>
|
||
|
<p><a href="#rzatefaq__question7">Back to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__package2"><a name="rzatefaq__package2"><!-- --></a><span><strong>What are the advantages of using SQL packages?</strong></span><p>Because
|
||
|
SQL packages are a shared resource, when a statement is prepared, the information
|
||
|
is available to all the users of the package. This saves processing time,
|
||
|
especially in an environment when many users are using the same or similar
|
||
|
statements. Because SQL packages are permanent, this information is also saved
|
||
|
across job initiation and end, and is also saved across system restarts. In
|
||
|
fact, SQL packages can be saved and restored on other systems. By comparison,
|
||
|
dynamic SQL requires that each user go through the preparatory processing
|
||
|
for a particular statement, and this must be done every time the user starts
|
||
|
the application.</p>
|
||
|
<p>SQL packages also allow the system to accumulate statistical
|
||
|
information about the SQL statements that result in better decisions about
|
||
|
how long to keep cursors open internally and how to best process the data
|
||
|
needed for the query. This information is shared across users and retained
|
||
|
for future use. In the case of dynamic SQL, this information must be gathered
|
||
|
by every job and every user.</p>
|
||
|
<p><a href="#rzatefaq__question7">Back to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__package3"><a name="rzatefaq__package3"><!-- --></a><span><strong>What data is stored in an SQL package?</strong></span><p>The
|
||
|
SQL package contains all the necessary information to run the prepared statement.
|
||
|
This includes registry of the statement name, the statement text, the internal
|
||
|
parse tree for the statement, definitions of all the tables and fields involved
|
||
|
in the statement, and the query access plan needed to access the tables at
|
||
|
run time.</p>
|
||
|
<p><a href="#rzatefaq__question7">Back
|
||
|
to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__package4"><a name="rzatefaq__package4"><!-- --></a><span><strong>How can I tell what statements are in an SQL package</strong>?</span><p>Use
|
||
|
the <a href="../cl/prtsqlinf.htm">Print SQL Information (PRTSQLINF)</a> command
|
||
|
to produce a formatted report that shows the SQL statement and information
|
||
|
about the access plan used to access the data.</p>
|
||
|
<p><a href="#rzatefaq__question7">Back to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__package5"><a name="rzatefaq__package5"><!-- --></a><span><strong>How can I tell if the SQL package is being used?</strong></span><div class="p">Use
|
||
|
the <a href="../cl/prtsqlinf.htm">Print SQL Information (PRTSQLINF)</a> command
|
||
|
to produce a formatted report that shows the SQL statement and information
|
||
|
about the access plan used to access the data. Use the database monitor to
|
||
|
log information about SQL processing on the system. It includes the name of
|
||
|
the package in the SQL summary records. The following statement shows the
|
||
|
package, the SQL operation, and the statement text:<pre>SELECT qqc103, qqc21, qq1000 from <db monitor file></pre>
|
||
|
</div>
|
||
|
<p>For
|
||
|
ODBC, you can also look in the job log for the message <tt>Extended Dynamic
|
||
|
has been disabled</tt> to determine if ODBC was unable to use an SQL package.</p>
|
||
|
<p><a href="#rzatefaq__question7">Back to questions</a></p>
|
||
|
</li>
|
||
|
</ol>
|
||
|
<p>For more SQL package FAQs, see the <a href="http://www-1.ibm.com/servers/eserver/iseries/db2/sqlperffaq.htm" target="_blank">DB2
|
||
|
Universal Database for iSeries Frequently Asked Questions: Improving Performance
|
||
|
with SQL Packages</a><img src="www.gif" alt="Link outside information center" />.</p>
|
||
|
</div>
|
||
|
<div class="section" id="rzatefaq__store"><a name="rzatefaq__store"><!-- --></a><h4 class="sectiontitle">Stored procedures</h4><ol><li id="rzatefaq__store1"><a name="rzatefaq__store1"><!-- --></a><span><strong>How can I view the contents of a result set and the
|
||
|
output parameters from a stored procedure call?</strong></span><p>Use Run SQL Scripts
|
||
|
to run the procedure in iSeries Navigator. First, open the Run SQL Scripts
|
||
|
window. Then, call the stored procedure using the <a href="../db2/rbafzmstcallsta.htm">CALL</a> statement,
|
||
|
pass the parameters to the statement, and then run the procedure. The parameters
|
||
|
are returned to the Result Set tab, and the output parameters are returned
|
||
|
to the Messages tab.</p>
|
||
|
<p><a href="#rzatefaq__question8">Back
|
||
|
to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__store2"><a name="rzatefaq__store2"><!-- --></a><span><strong>Can existing RPG or COBOL programs be used as stored
|
||
|
procedures?</strong></span><p>Yes. DB2 UDB for iSeries supports external stored procedures,
|
||
|
which allows existing high-level programs to be called as stored procedures.
|
||
|
The CREATE PROCEDURE statement is used to register these programs as stored
|
||
|
procedures.</p>
|
||
|
<p><a href="#rzatefaq__question8">Back
|
||
|
to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__store3"><a name="rzatefaq__store3"><!-- --></a><span><strong>I do a CREATE PROCEDURE that contains SQL statements
|
||
|
that reference user-defined functions. Before calling the procedure, I do
|
||
|
a SET PATH so the functions are found. Why aren't the functions found when
|
||
|
I call the procedure?</strong></span><p>The SET PATH statement must be done before
|
||
|
the CREATE PROCEDURE statement. The path for static statements in a precompiled
|
||
|
program is determined when the program is created. In the case of CREATE PROCEDURE,
|
||
|
we create an SQL C program. Dynamic statements in the procedure use the current
|
||
|
path, but the static statements in the procedure use the path that was used
|
||
|
at the time of creation. This is also true for the CREATE FUNCTION statement. </p>
|
||
|
<p><a href="#rzatefaq__question8">Back to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__store4"><a name="rzatefaq__store4"><!-- --></a><span><strong>How do I find out if a stored procedure exists, in
|
||
|
what library it exists, and what the attributes of the stored procedure are?</strong></span><div class="p">To
|
||
|
see the stored procedures on the system, you need to query the SYSPROCS catalog
|
||
|
view. For example: <pre>SELECT * from sysprocs where routine_name = 'MYPROC' and routine_schema = 'MYLIB'</pre>
|
||
|
This
|
||
|
checks to see if there is a stored procedure named <em>myproc</em> in <em>mylib</em>.
|
||
|
If you do not know the library, do not include the <em>routine_schema</em> part
|
||
|
of the search condition in the query. See <a href="../db2/rbafzmstcatalogtbls.htm"> iSeries catalog
|
||
|
tables and views</a> in the SQL reference topic for the definition of all
|
||
|
the columns for the SYSPROCS catalog. You might also be interested in the
|
||
|
SYSPARMS catalog, which contains the parameter definitions for a procedure.</div>
|
||
|
<p><a href="#rzatefaq__question8">Back to questions</a></p>
|
||
|
</li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
<div class="section" id="rzatefaq__trigger"><a name="rzatefaq__trigger"><!-- --></a><h4 class="sectiontitle">Triggers</h4><ol><li id="rzatefaq__trigger1"><a name="rzatefaq__trigger1"><!-- --></a><span><strong>What is a trigger?</strong></span><p>A trigger is a set
|
||
|
of actions that are run automatically when a specified change or read operation
|
||
|
is performed on a specified table or on a specified physical database file.
|
||
|
For more information, see <a href="../dbp/rbaforzahftra.htm">Trigger
|
||
|
automatic events in your database</a>.</p>
|
||
|
<p>Beginning in V5R1, you can
|
||
|
also use SQL triggers. The SQL CREATE TRIGGER statement provides a way for
|
||
|
the database management system to actively control, monitor, and manage a
|
||
|
group of tables whenever an insert, update, or delete operation is performed.
|
||
|
The statements specified in the SQL trigger are run each time an SQL insert,
|
||
|
update, or delete operation is performed. An SQL trigger can call stored procedures
|
||
|
or user-defined functions to perform additional processing when the trigger
|
||
|
is run. For more information, see <a href="../sqlp/rbafysqltrig.htm">SQL
|
||
|
triggers</a>.</p>
|
||
|
<p><a href="#rzatefaq__question9">Back
|
||
|
to questions</a></p>
|
||
|
</li>
|
||
|
<li id="rzatefaq__trigger2"><a name="rzatefaq__trigger2"><!-- --></a><span><strong>Why does my trigger program not
|
||
|
work after upgrading i5/OS?</strong></span><p>The offset of your record might have
|
||
|
changed. For several releases in the past, the offset did not change. It did,
|
||
|
however, change for V5R1 and might change in subsequent releases. The easiest
|
||
|
solution is to always code your trigger programs to use the offsets and lengths
|
||
|
passed in the trigger buffer. For a summary of fields in the trigger buffer,
|
||
|
see <a href="../dbp/rbaforzahftrd.htm">Trigger buffer field
|
||
|
descriptions</a>.</p>
|
||
|
<p><a href="#rzatefaq__question9">Back
|
||
|
to questions</a></p>
|
||
|
</li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzatekickoff.htm" title="These topics provide solutions to common questions and problems for the DB2 for iSeries database.">Troubleshooting</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|