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

131 lines
8.5 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<?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))' />
<meta name="keywords" content="identifiers, SQL (Structured Query Language),
description, in SQL, ordinary identifier, ordinary, reserved words, reserved,
words, delimited identifier, escape character in SQL, escape character,
' (apostrophe), ' (quotation mark), delimited, in system names,
system identifier, system, host identifier, host" />
<title>Identifiers</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="ch2iden"></a>
<h2 id="ch2iden"><a href="rbafzmst02.htm#ToC_83">Identifiers</a></h2><a id="idx232" name="idx232"></a><a id="idx233" name="idx233"></a>
<p>An <span class="italic">identifier</span> is a token used to form a name. An
identifier in an SQL statement is one of the following types:</p>
<ul>
<li><a href="rbafzmstch2iden.htm#sqlidts">SQL identifiers</a></li>
<li><a href="rbafzmstch2iden.htm#ch2sysident">System identifiers</a></li>
<li><a href="rbafzmstch2iden.htm#ch2hostiden">Host identifiers</a></li></ul><p class="indatacontent"> </p>
<a name="wq66"></a>
<div class="notetitle" id="wq66">Note:</div>
<div class="notebody">$, @, #, and all other variant characters should not
be used in identifiers because the code points used to represent them vary
depending on the CCSID of the string in which they are contained. If they
are used, unpredictable results may occur. For more information about variant
characters, see the <a href="../nls/rbagsdb2qmansqlsortseq.htm">Variant characters</a> topic in
the iSeries Information Center.</div>
<a name="sqlidts"></a>
<h3 id="sqlidts"><a href="rbafzmst02.htm#ToC_84">SQL identifiers</a></h3>
<p><a id="idx234" name="idx234"></a><a id="idx235" name="idx235"></a><a id="idx236" name="idx236"></a><a id="idx237" name="idx237"></a><a id="idx238" name="idx238"></a><a id="idx239" name="idx239"></a><a id="idx240" name="idx240"></a><a id="idx241" name="idx241"></a><a id="idx242" name="idx242"></a><a id="idx243" name="idx243"></a><a id="idx244" name="idx244"></a><a id="idx245" name="idx245"></a></p>
<p>There are two types of SQL identifiers: <span class="italic">ordinary identifiers</span> and <span class="italic">delimited identifiers</span>. </p>
<ul>
<li>An <span class="italic">ordinary identifier</span> is an uppercase letter
followed by zero or more characters, each of which is an uppercase letter,
a digit, or the underscore character. Note that ordinary identifiers are converted
to uppercase. An ordinary identifier should not be a reserved word. See <a href="rbafzmstresword.htm#resword">Appendix H. Reserved schema names and reserved words</a> for a list of reserved words. If a reserved word is used
as an identifier in SQL, it should be specified in uppercase and must be a
delimited identifier or specified in a variable.</li>
<li>A <span class="italic">delimited identifier</span> is a sequence of one or
more characters enclosed within SQL escape characters. The sequence must consist
of one or more characters. Leading blanks in the sequence are significant.
Trailing blanks in the sequence are not significant. The length of a delimited
identifier does not include the two SQL escape characters. Note that delimited
identifiers are not converted to uppercase. The escape character is the quotation
mark (&quot;) except in the following cases where the escape character is the
apostrophe ('):
<ul>
<li>Interactive SQL when the SQL string delimiter is set to the quotation
mark in COBOL syntax checking statement mode</li>
<li>Dynamic SQL in a COBOL program when the CRTSQLCBL or CRTSQLCBLI parameter
OPTION(*QUOTESQL) specifies that the string delimiter is the quotation mark
(&quot;)</li>
<li>COBOL application program when the CRTSQLCBL or CRTSQLCBLI parameter OPTION(*QUOTESQL)
specifies that the string delimiter is the quotation mark (&quot;)</li></ul>
<p>The following characters are not allowed within delimited identifiers: </p>
<ul>
<li><span class="hex">X'00'</span> through <span class="hex">X'3F'</span> and <span class="hex">X'FF'</span></li></ul></li></ul>
<a name="ch2sysident"></a>
<h3 id="ch2sysident"><a href="rbafzmst02.htm#ToC_85">System identifiers</a></h3><a id="idx246" name="idx246"></a><a id="idx247" name="idx247"></a>
<p>A system identifier is used to form the name of system objects in i5/OS.
There are two types of system identifiers: ordinary identifiers and delimited
identifiers. </p>
<ul>
<li>The rules for forming a system ordinary identifier are identical to the
rules for forming an SQL ordinary identifier.</li>
<li>The rules for forming a system delimited identifier are identical to those
for forming SQL delimited identifiers, except:
<ul>
<li>The following special characters are not allowed in a delimited system
identifier:
<ul>
<li>A blank (<span class="hex">X'40'</span>)</li>
<li>An asterisk (<span class="hex">X'5C'</span>)</li>
<li>An apostrophe (<span class="hex">X'7D'</span>)</li>
<li>A question mark (<span class="hex">X'6F'</span>)</li>
<li>A quotation mark (<span class="hex">X'7F'</span>)</li></ul></li>
<li>The bytes required for the escape characters are included in the length
of the identifier unless the characters within the delimiters would form an
ordinary identifier.
<p>For example, &quot;PRIVILEGES&quot; is in uppercase
and the characters within the delimiters form an ordinary identifier; therefore,
it has a length of 10 bytes and is a valid system name for a column. On the
other hand, &quot;privileges&quot; is in lowercase, has a length of 12 bytes,
and is not a valid system name for a column because the bytes required for
the delimiters must be included in the length of the identifier.</p></li></ul></li></ul>
<a name="wq67"></a>
<h4 id="wq67">Examples</h4>
<p></p>
<pre class="xmp"> WKLYSAL WKLY_SAL "WKLY_SAL" "UNION" "wkly_sal"</pre>
<a name="ch2hostiden"></a>
<h3 id="ch2hostiden"><a href="rbafzmst02.htm#ToC_87">Host identifiers</a></h3><a id="idx248" name="idx248"></a><a id="idx249" name="idx249"></a>
<p>A <var class="pv">host-identifier</var> is a name declared in the host
program. The rules for forming a host-identifier are the rules of the host
language; except that DBCS characters cannot be used. For example, the rules
for forming a host-identifier in a COBOL program are the same as the rules
for forming a user-defined word in COBOL. Names beginning with the characters 'SQ'<sup class="fn"><a href="rbafzmstch2iden.htm#fn9">16</a></sup>, 'SQL', 'sql', 'RDI', or 'DSN'
should not be used because precompilers generate host variables that begin
with these characters. <span>In Java&trade;, do not use names beginning with <tt class="xph">'__sJT_'</tt>.</span></p>
<p>See <a href="rbafzmstch2nam.htm#bable1">Table 2</a> for the limits on the maximum size of the host
identifier name imposed by DB2 UDB for iSeries.</p>
<hr /><div class="fnnum"><a id="fn9" name="fn9">16</a>.</div>
<div class="fntext">'SQ' is allowed in C, COBOL, and PL/I; it should not
be used in RPG.</div>
<br />
<hr /><br />
[ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzmstch2tok.htm">Previous Page</a> | <a href="rbafzmstch2nam.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>