ibm-information-center/dist/eclipse/plugins/i5OS.ic.db2_5.4.0.1/rbafzmstcatalognotes.htm

179 lines
9.4 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 xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="dc.language" scheme="rfc1766" 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. -->
<meta name="dc.date" scheme="iso8601" content="2005-09-19" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<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))' />
<title>Notes</title>
<link rel="stylesheet" type="text/css" href="ibmidwb.css" />
<link rel="stylesheet" type="text/css" href="ic.css" />
</head>
<body>
<a id="Top_Of_Page" name="Top_Of_Page"></a><!-- Java sync-link -->
<script language = "Javascript" src = "../rzahg/synch.js" type="text/javascript"></script>
<a name="catalognotes"></a>
<h2 id="catalognotes"><a href="rbafzmst02.htm#ToC_1513">Notes</a></h2>
<p><span class="bold">Names in the Catalog:</span> In general, all names stored
in columns of a catalog table are undelimited and case sensitive. For example,
assume the following table was created: </p>
<pre class="xmp"> <span class="bold">CREATE TABLE</span> "colname"/"long_table_name"
("long_column_name" <span class="bold">CHAR</span>(10),
INTCOL <span class="bold">INTEGER</span>) </pre><p class="indatacontent">If
the following select statement is used to return information about the mapping
between SQL names and system names, the following select statement could be
used: </p>
<pre class="xmp"> <span class="bold">SELECT</span> TABLE_NAME, SYSTEM_TABLE_NAME, COLUMN_NAME, SYSTEM_COLUMN_NAME
<span class="bold">FROM</span> QSYS2/SYSCOLUMNS
<span class="bold">WHERE</span> TABLE_NAME = 'long_table_name' <span class="bold">AND</span>
TABLE_SCHEMA = 'colname'</pre><p class="indatacontent">The following rows would be returned:</p>
<a name="wq2162"></a>
<table id="wq2162" width="100%" summary="" border="0" frame="void" rules="all">
<thead valign="bottom">
<tr>
<th id="wq2163" width="19%" align="left" valign="bottom">TABLE_NAME</th>
<th id="wq2164" width="25%" align="left" valign="bottom">SYSTEM_TABLE_NAME</th>
<th id="wq2165" width="24%" align="left" valign="bottom">COLUMN_NAME</th>
<th id="wq2166" width="30%" align="left" valign="bottom">SYSTEM_COLUMN_NAME</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="left" valign="top" headers="wq2163">long_table_name</td>
<td align="left" valign="top" headers="wq2164">"long0001"</td>
<td align="left" valign="top" headers="wq2165">long_column_name</td>
<td align="left" valign="top" headers="wq2166">LONG_00001</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq2163">long_table_name</td>
<td align="left" valign="top" headers="wq2164">"long0001"</td>
<td align="left" valign="top" headers="wq2165">INTCOL</td>
<td align="left" valign="top" headers="wq2166">INTCOL</td>
</tr>
</tbody>
</table>
<p><span class="bold">System Names in the Catalog:</span> In general, the longer
SQL column names should be used rather than the short system column names.
The short system column names for iSeries&trade; catalog tables and views are explicitly
maintained for compatibility with prior releases and other DB2&reg; UDB products.
The short system column names for the ODBC and JDBC catalog views and the
ANS and ISO catalog views are not explicitly maintained and may change between
releases.</p>
<p><span class="bold">Null Values in the Catalog:</span> If the information in
a column is not applicable, the null value is returned. Using the table created
above, the following select statement, which queries the NUMERIC_SCALE and
the CHARACTER_MAXIMUM_LENGTH, would return the null value when the data was
not applicable to the data type of the column. </p>
<pre class="xmp"> <span class="bold">SELECT</span> COLUMN_NAME, NUMERIC_SCALE, CHARACTER_MAXIMUM_LENGTH
<span class="bold">FROM</span> QSYS2/SYSCOLUMNS
<span class="bold">WHERE</span> TABLE_NAME = 'long_table_name' <span class="bold">AND</span>
TABLE_SCHEMA = 'colname'</pre>
<p>The following rows would be returned: </p>
<a name="wq2167"></a>
<table id="wq2167" width="100%" summary="" border="0" frame="void" rules="all">
<thead valign="bottom">
<tr>
<th id="wq2168" width="30%" align="left" valign="bottom">COLUMN_NAME</th>
<th id="wq2169" width="29%" align="left" valign="bottom">NUMERIC_SCALE</th>
<th id="wq2170" width="40%" align="left" valign="bottom">CHARACTER_MAXIMUM_LENGTH</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="left" valign="top" headers="wq2168">long_column_name</td>
<td align="left" valign="top" headers="wq2169">?</td>
<td align="left" valign="top" headers="wq2170">10</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq2168">INTCOL</td>
<td align="left" valign="top" headers="wq2169">0</td>
<td align="left" valign="top" headers="wq2170">?</td>
</tr>
</tbody>
</table>
<p>Because numeric scale is not valid for a character column, the null value
is returned for NUMERIC_SCALE for the "long_column_name" column. Because character
length is not valid for a numeric column, the null value is returned for CHARACTER_MAXIMUM_LENGTH
for the INTCOL column.</p>
<p><span class="bold">Install and Backup Considerations:</span> Certain catalog
tables and any views created over the catalog tables and views should be regularly
saved:</p>
<ul>
<li>The catalog table QSYS.QADBXRDBD contains relational database information.
This table should be regularly saved.</li>
<li>When an ILE external function or procedure or an SQL function or procedure
is restored, information is automatically inserted into these catalog tables.
This does not occur for non-ILE external functions and procedures. In order
to back up the definitions of non-ILE external functions or procedures, ensure
that the catalog tables SYSROUTINES and SYSPARMS are saved or ensure you have
a back up of the SQL source statements that were used to create these functions
and procedures.</li>
<li>All catalog views in the QSYS2 or SYSIBM schemas are system objects. This
means that any user views created over these catalog views must be deleted
when the operating system is installed. All dependent objects must be deleted
as well. To avoid this requirement, you can save views before installation
and then restore them afterwards.</li>
<li>Catalog tables in the QSYS library are also system objects. However, the
catalog tables in the QSYS library are not deleted during installation. Hence,
any views created over these tables are preserved throughout the installation
process.</li></ul>
<p><span class="bold">Granting Privileges to Catalog Views:</span> Tables and
views in the catalog are like any other database tables and views. If you
have authorization, you can use SQL statements to look at data in the catalog
views in the same way that you retrieve data from any other table. The tables
and views in the catalogs are shipped with the SELECT privilege to PUBLIC.
This privilege may be revoked and the SELECT privilege granted to individual
users.</p>
<p><span class="bold">QSYS Catalog Tables:</span> Most of the catalog views are
based on the following tables in the QSYS library (sometimes called the database
cross reference files). These tables are not shipped with the SELECT privilege
to PUBLIC and should not be used directly: </p>
<a name="wq2171"></a>
<table id="wq2171" width="100%" summary="" border="0" frame="void" rules="none">
<tbody valign="top">
<tr>
<td width="33%" align="left" valign="top">QADBCCST</td>
<td width="33%" align="left" valign="top">QADBKFLD</td>
<td width="33%" align="left" valign="top">QADBXSFLD</td>
</tr>
<tr>
<td align="left" valign="top">QADBFDEP</td>
<td align="left" valign="top">QADBPKG</td>
<td align="left" valign="top">QADBXTRIGB</td>
</tr>
<tr>
<td align="left" valign="top">QADBFCST</td>
<td align="left" valign="top">QADBXRDBD</td>
<td align="left" valign="top">QADBXTRIGC</td>
</tr>
<tr>
<td align="left" valign="top">QADBIFLD</td>
<td align="left" valign="top">QADBXREF</td>
<td align="left" valign="top">QADBXTRIGD</td>
</tr>
</tbody>
</table>
<p><span class="bold">Use of SELECT *:</span> New columns are likely to be added
to tables and views in the catalog as new functionality is implemented and
as the ISO/ANSI standards evolve. For this reason, it is recommended that
SELECT * not be used when accessing catalog tables and views unless your application
is prepared to tolerate these new columns.</p>
<hr /><br />
[ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzmstcatalog.htm">Previous Page</a> | <a href="rbafzmstcatalogtbls.htm">Next Page</a> | <a href="rbafzmst02.htm#wq1">Contents</a> |
<a href="rbafzmstindex.htm#index">Index</a> ]
<a id="Bot_Of_Page" name="Bot_Of_Page"></a>
</body>
</html>