696 lines
42 KiB
HTML
696 lines
42 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))' />
|
|
<meta name="keywords" content="naming conventions in SQL, naming conventions,
|
|
SQL (Structured Query Language), names in SQL, rules, variable names used,
|
|
description, alias-name, definition, authorization-name, column-name,
|
|
constraint-name, correlation name, cursor-name, descriptor-name,
|
|
distinct-type-name, external-program-name, jar-name, class-id, method-id,
|
|
function-name, host-label, host variable, in host variable, host-identifier,
|
|
index-name, nodegroup-name, package-name, parameter-name, procedure-name,
|
|
schema-name, sequence-name, server-name, specific-name, SQL-descriptor-name,
|
|
SQL-label, SQL-parameter-name, SQL-variable-name, statement-name,
|
|
system-column-name, system-object-name, table-name, trigger-name, view-name,
|
|
identifier, limits, identifiers, SQL path, in SQL path, collection,
|
|
function resolution, use of SQL path, static SQL, dynamic SQL,
|
|
name qualification, default schema, OVRDBF (Override with Data Base file)" />
|
|
<title>Naming conventions</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="ch2nam"></a>
|
|
<h2 id="ch2nam"><a href="rbafzmst02.htm#ToC_88">Naming conventions</a></h2><a id="idx250" name="idx250"></a><a id="idx251" name="idx251"></a><a id="idx252" name="idx252"></a><a id="idx253" name="idx253"></a>
|
|
<p>The rules for forming a name depend on the type of the object designated
|
|
by the name and the naming option (*SQL or *SYS). The naming option is specified
|
|
on the CRTSQLxxx, RUNSQLSTM, and STRSQL commands. The SET OPTION statement
|
|
can be used to specify the naming option within the source of a program containing
|
|
embedded SQL. The syntax diagrams use different terms for different types
|
|
of names. The following list defines these terms. </p>
|
|
<dl>
|
|
<dt class="bold">alias-name</dt><a id="idx254" name="idx254"></a>
|
|
<dd>A qualified or unqualified name that designates an alias. The qualified
|
|
form of an <var class="pv">alias-name</var> depends on the naming option. For SQL naming,
|
|
the qualified form is a <var class="pv">schema-name</var> followed by a period (.) and
|
|
an SQL identifier. For system naming, the qualified form is a <var class="pv">schema-name</var> followed by a slash (/) followed by an SQL identifier.
|
|
<p>The unqualified
|
|
form of an <var class="pv">alias-name</var> is an SQL identifier. The unqualified form
|
|
is implicitly qualified based on the rules specified in <a href="rbafzmstch2nam.htm#qualun">Qualification of unqualified object names</a>.</p>
|
|
<p>An <var class="pv">alias-name</var> can specify either the name of the alias or
|
|
the system object name of the alias.</p>
|
|
</dd>
|
|
<dt class="bold">authorization-name</dt><a id="idx255" name="idx255"></a>
|
|
<dd>A system identifier that designates a user or group of users. An <var class="pv">authorization-name</var> is a user profile name on the server. It must not
|
|
be a delimited identifier that includes lowercase letters or special characters.
|
|
See <a href="rbafzmstch2auth.htm#ch2auth">Authorization IDs and authorization names</a> for the distinction between an <var class="pv">authorization-name</var> and an authorization ID.
|
|
</dd>
|
|
<dt class="bold">column-name</dt><a id="idx256" name="idx256"></a>
|
|
<dd>A qualified or unqualified name that designates a column of a table
|
|
or a view. The unqualified form of a <var class="pv">column-name</var> is an SQL identifier.
|
|
The qualified form is a qualifier followed by a period and an SQL identifier.
|
|
The qualifier is a table name, a view name, or a correlation name.
|
|
<p>Column
|
|
names cannot be qualified with system names in the form <var class="pv">schema-name</var>/<var class="pv">table-name</var>.<var class="pv">column-name</var>, except in the COMMENT and LABEL statements.
|
|
If column names need to be qualified, and correlation names are allowed in
|
|
the statement, a correlation name must be used to qualify the column.</p>
|
|
<p>A <var class="pv">column-name</var> can specify either the column name or the system column
|
|
name of a column of a table or view. If a <var class="pv">column-name</var> is delimited,
|
|
the delimiters are considered to be part of the name when determining the
|
|
length of the name.</p>
|
|
</dd>
|
|
<dt class="bold">constraint-name</dt><a id="idx257" name="idx257"></a>
|
|
<dd>A qualified or unqualified name that designates a constraint on a table.
|
|
The qualified form of a <var class="pv">constraint-name</var> depends on the naming option.
|
|
For SQL naming, the qualified form is a <var class="pv">schema-name</var> followed by a
|
|
period (.) and a system identifier. For system naming, the qualified form
|
|
is a <var class="pv">schema-name</var> followed by a slash (/) followed by an SQL identifier.
|
|
<p>The unqualified form of a <var class="pv">constraint-name</var> is an SQL identifier. The
|
|
unqualified form is implicitly qualified based on the rules specified in <a href="rbafzmstch2nam.htm#qualun">Qualification of unqualified object names</a>.</p>
|
|
</dd>
|
|
<dt class="bold">correlation-name</dt><a id="idx258" name="idx258"></a>
|
|
<dd>An SQL identifier that designates a table, a view, or individual rows
|
|
of a table or view.
|
|
</dd>
|
|
<dt class="bold">cursor-name</dt><a id="idx259" name="idx259"></a>
|
|
<dd>An SQL identifier that designates an SQL cursor.
|
|
</dd>
|
|
<dt class="bold">descriptor-name</dt><a id="idx260" name="idx260"></a>
|
|
<dd>A variable name or string constant that designates an SQL descriptor
|
|
area (SQLDA). A variable that designates an SQL descriptor area must not have
|
|
an indicator variable. The form <var class="pv">:host-variable:indicator-variable</var> is
|
|
not allowed. See <a href="rbafzmstch2refvar.htm#ch2host">References to host variables</a> for a description of a variable.
|
|
</dd>
|
|
<dt class="bold">distinct-type-name</dt><a id="idx261" name="idx261"></a>
|
|
<dd>A qualified or unqualified name that designates a distinct type. The
|
|
qualified form of a <var class="pv">distinct-type-name</var> depends upon the naming option.
|
|
For SQL naming, the qualified form is a <var class="pv">schema-name</var> followed by a
|
|
period (.) and an SQL identifier. For system naming, the qualified form is
|
|
a <var class="pv">schema-name</var> followed by a slash (/) followed by an SQL identifier.
|
|
<p>The unqualified form of a <var class="pv">distinct-type-name</var> is an SQL identifier.
|
|
The unqualified form is implicitly qualified based on the rules specified
|
|
in <a href="rbafzmstch2nam.htm#qualun">Qualification of unqualified object names</a>.</p>
|
|
<p>For system naming, <var class="pv">distinct-type-names</var> cannot be qualified when used in a parameter data type of an SQL routine
|
|
or in an SQL variable declaration in an SQL function, SQL procedure, or trigger.</p>
|
|
</dd>
|
|
<dt class="bold">external-program-name</dt><a id="idx262" name="idx262"></a>
|
|
<dd>A qualified name, unqualified name, or a character string that designates
|
|
an external program. The qualified form of an <var class="pv">external-program-name</var> depends
|
|
on the naming option. For SQL naming, the qualified form is a <var class="pv">schema-name</var> followed by a period (.) and a system identifier. For system naming,
|
|
the qualified form is a <var class="pv">schema-name</var> followed by a slash (/) followed
|
|
by a system identifier.
|
|
<p>The unqualified form of an <var class="pv">external-program-name</var> is a system identifier. The unqualified form is implicitly qualified
|
|
based on the rules specified in <a href="rbafzmstch2nam.htm#qualun">Qualification of unqualified object names</a>.</p>
|
|
<p>The format of
|
|
the character string form is either: </p>
|
|
<ul>
|
|
<li>An i5/OS qualified program name ('library-name/program-name').</li>
|
|
<li>An i5/OS qualified source file name, followed by a left parenthesis,
|
|
followed by an i5/OS member name, and a right parenthesis ('library-name/source-file-name(member-name)').
|
|
This form is only valid when calling a REXX procedure.</li>
|
|
<li>An i5/OS qualified service program name, followed by a left parenthesis,
|
|
followed by an i5/OS entry-point-name, followed by a right parenthesis ('library-name/service-program-name(entry-point-name)').</li>
|
|
<li>In Java™, an optional <var class="pv">jar-name</var>, followed by a class identifier,
|
|
followed by an exclamation point or period, followed by a method identifier
|
|
('class-id!method-id' or 'class-id.method-id').
|
|
<a href="rbafzmstch2nam.htm#synnaming"><img src="c.gif" alt="Click to skip syntax diagram" /></a>
|
|
|
|
<pre class="cgraphic"><span><img src="c.gif" alt="Read syntax diagram" longdesc="rbafzmstsyn12.htm"
|
|
border="0" /></span><a href="#skipsyn-11"><img src="c.gif" alt="Skip visual syntax diagram"
|
|
border="0" /></a>>>-+-------------+--<span class="italic">class-id</span>--+-!-+--<span class="italic">method-id</span>-----------------><
|
|
'-<span class="italic">jar-name</span>--:-' '-.-'
|
|
|
|
</pre>
|
|
<a name="skipsyn-11" id="skipsyn-11"></a>
|
|
|
|
<a name="synnaming"></a>
|
|
<dl id="synnaming">
|
|
<dt class="bold">jar-name</dt><a id="idx263" name="idx263"></a>
|
|
<dd>The <var class="pv">jar-name</var> is a case-sensitive string that identifies the
|
|
jar schema when it was installed in the database. It can be either a simple
|
|
identifier, or a schema qualified identifier. Examples are 'myJar' and 'myCollection.myJar'.
|
|
</dd>
|
|
<dt class="bold">class-id</dt><a id="idx264" name="idx264"></a>
|
|
<dd>
|
|
<p>The <var class="pv">class-id</var> identifies the class identifier of the Java object. If the class is part of a Java package, the class identifier must
|
|
include the complete Java package prefix. For example, if the
|
|
class identifier is 'myPackage.StoredProcs', the Java virtual machine will look in the following
|
|
directory for the StoredProcs class:</p>
|
|
<pre class="xmp"> '/QIBM/UserData/OS400/SQLLib/
|
|
Function/myPackage/StoredProcs/'</pre>
|
|
</dd>
|
|
<dt class="bold">method-id</dt><a id="idx265" name="idx265"></a>
|
|
<dd>
|
|
<p>The <var class="pv">method-id</var> identifies the method name of the public,
|
|
static Java method to be invoked.</p>
|
|
</dd>
|
|
</dl>
|
|
<p>This form is only valid for Java procedures and Java functions.</p></li></ul>
|
|
</dd>
|
|
<dt class="bold">function-name</dt><a id="idx266" name="idx266"></a>
|
|
<dd>A qualified or unqualified name that designates a user-defined function,
|
|
a cast function that was generated when a distinct type was created, or a
|
|
built-in function. The qualified form of a <var class="pv">function-name</var> depends
|
|
upon the naming option. For SQL naming, the qualified form is a <var class="pv">schema-name</var> followed by a period (.) and an SQL identifier. For system naming, the
|
|
qualified form is a <var class="pv">schema-name</var> followed by a slash (/) followed
|
|
by an SQL identifier.
|
|
<p>The unqualified form of a <var class="pv">function-name</var> is
|
|
an SQL identifier. The unqualified form is implicitly qualified based on the
|
|
rules specified in <a href="rbafzmstch2nam.htm#qualun">Qualification of unqualified object names</a>.</p>
|
|
<p>For system naming, functions
|
|
names can only be qualified in the form <var class="pv">schema-name</var>/<var class="pv">function-name</var> when the name is used in a CREATE, COMMENT, DROP, GRANT, or REVOKE statement.</p>
|
|
</dd>
|
|
<dt class="bold">host-label</dt><a id="idx267" name="idx267"></a>
|
|
<dd>A token that designates a label in a host program.
|
|
</dd>
|
|
<dt class="bold">host-variable</dt><a id="idx268" name="idx268"></a><a id="idx269" name="idx269"></a>
|
|
<dd>A sequence of tokens that designates a host variable. A <var class="pv">host-variable</var> includes at least one <var class="pv">host-identifier</var>, as explained in <a href="rbafzmstch2refvar.htm#ch2host">References to host variables</a>.
|
|
</dd>
|
|
<dt class="bold">index-name</dt><a id="idx270" name="idx270"></a>
|
|
<dd>A qualified or unqualified name that designates an index. The qualified
|
|
form of an <var class="pv">index-name</var> depends upon the naming option. For SQL naming,
|
|
the qualified form is a <var class="pv">schema-name</var> followed by a period (.) and
|
|
an SQL identifier. For system naming, the qualified form is a <var class="pv">schema-name</var> followed by a slash (/) followed by an SQL identifier.
|
|
<p>The unqualified
|
|
form of an <var class="pv">index-name</var> is an SQL identifier. The unqualified form
|
|
is implicitly qualified based on the rules specified in <a href="rbafzmstch2nam.htm#qualun">Qualification of unqualified object names</a>.</p>
|
|
</dd>
|
|
<dt class="bold">nodegroup-name</dt><a id="idx271" name="idx271"></a>
|
|
<dd>A qualified or unqualified name that designates a nodegroup. A nodegroup
|
|
is a group of iSeries servers across which a table will be distributed. For
|
|
more information about distributed tables and nodegroups, see the <a href="../dbmult/rzaf3kickoff.htm">DB2® Multisystem</a> book.
|
|
<p>The qualified form of a <var class="pv">nodegroup-name</var> depends on the
|
|
naming option. For SQL naming, the qualified form is a <var class="pv">schema-name</var> followed
|
|
by a period (.) and a system identifier. For system naming, the qualified
|
|
form is a <var class="pv">schema-name</var> followed by a slash (/) followed by a system
|
|
identifier.</p>
|
|
<p>The unqualified form of a <var class="pv">nodegroup-name</var> is a system
|
|
identifier. The unqualified form is implicitly qualified based on the rules
|
|
specified in <a href="rbafzmstch2nam.htm#qualun">Qualification of unqualified object names</a>.</p>
|
|
</dd>
|
|
<dt class="bold">package-name</dt><a id="idx272" name="idx272"></a>
|
|
<dd>A qualified or unqualified name that designates a package. The qualified
|
|
form of a <var class="pv">package-name</var> depends upon the naming option. For SQL naming,
|
|
the qualified form is a <var class="pv">schema-name</var> followed by a period (.) and
|
|
a system identifier. For system naming, the qualified form is a <var class="pv">schema-name</var> followed by a slash (/) followed by a system identifier.
|
|
<p>The unqualified
|
|
form of a <var class="pv">package-name</var> is a system identifier. The unqualified form
|
|
is implicitly qualified based on the rules specified in <a href="rbafzmstch2nam.htm#qualun">Qualification of unqualified object names</a>.</p>
|
|
</dd>
|
|
<dt class="bold">parameter-name</dt><a id="idx273" name="idx273"></a>
|
|
<dd>An SQL identifier that designates a parameter for a function or procedure.
|
|
If the <var class="pv">parameter-name</var> is for a procedure, the identifier may be
|
|
preceded by a colon.
|
|
</dd>
|
|
<dt class="bold">partition-name</dt>
|
|
<dd>An unqualified identifier that designates a partition of a partitioned
|
|
table.
|
|
</dd>
|
|
<dt class="bold">procedure-name</dt><a id="idx274" name="idx274"></a>
|
|
<dd>A qualified or unqualified name that designates a procedure. The qualified
|
|
form of a <var class="pv">procedure-name</var> depends upon the naming option. For SQL
|
|
naming, the qualified form is a <var class="pv">schema-name</var> followed by a period
|
|
(.) and an SQL identifier. For system naming, the qualified form is a <var class="pv">schema-name</var> followed by a slash (/) followed by an SQL identifier.
|
|
<p>The unqualified form of a <var class="pv">procedure-name</var> is an SQL identifier. The
|
|
unqualified form is implicitly qualified based on the rules specified in <a href="rbafzmstch2nam.htm#qualun">Qualification of unqualified object names</a>.</p>
|
|
</dd>
|
|
<dt class="bold">savepoint-name</dt>
|
|
<dd>An unqualified identifier that designates a savepoint.
|
|
</dd>
|
|
<dt class="bold">schema-name</dt><a id="idx275" name="idx275"></a>
|
|
<dd>A qualified or unqualified name that provides a logical grouping for
|
|
SQL objects. A schema name is used as a qualifier of the name of a table,
|
|
view, index, procedure, function, trigger, constraint, alias, type, or package.
|
|
The unqualified form of a <var class="pv">schema-name</var> is a system identifier. The
|
|
qualified form of a <var class="pv">schema-name</var> depends on the naming option.
|
|
<p>For SQL names, the unqualified schema name in an SQL statement is implicitly
|
|
qualified by the <var class="pv">server-name</var>. The qualified form is a <var class="pv">server-name</var> followed by a (.) and a system identifier. The <var class="pv">server-name</var> must
|
|
identify the current server.</p>
|
|
<p>For system names, the unqualified schema
|
|
name in an SQL statement is implicitly qualified by the <var class="pv">server-name</var>.
|
|
The qualified form is a <var class="pv">server-name</var> followed by a slash (/) and a
|
|
system identifier. The <var class="pv">server-name</var> must identify the current server.</p>
|
|
<a name="wq68"></a>
|
|
<div class="notetitle" id="wq68">Note:</div>
|
|
<div class="notebody"><var class="pv">schema-name</var> refers to either a schema created
|
|
by the CREATE SCHEMA statement or to an i5/OS library.</div>
|
|
</dd>
|
|
<dt class="bold">sequence-name</dt><a id="idx276" name="idx276"></a>
|
|
<dd>A qualified or unqualified name that designates a sequence.
|
|
The qualified form of a <var class="pv">sequence-name</var> depends upon the naming option.
|
|
For SQL naming, the qualified form is a <var class="pv">schema-name</var> followed by a
|
|
period (.) and an SQL identifier. For system naming, the qualified form is
|
|
a <var class="pv">schema-name</var> followed by a slash (/) followed by an SQL identifier. <span>For system naming, a <var class="pv">sequence-name</var> cannot be qualified
|
|
when used in a NEXT VALUE or PREVIOUS VALUE expression (the qualified form
|
|
is only allowed in SQL schema statements).</span>
|
|
<p>The unqualified form of
|
|
a <var class="pv">sequence-name</var> is an SQL identifier. The unqualified form is implicitly
|
|
qualified based on the rules specified in <a href="rbafzmstch2nam.htm#qualun">Qualification of unqualified object names</a>.</p>
|
|
<p>A <var class="pv">sequence-name</var> can specify either the name of the sequence or the system
|
|
object name of the sequence.</p>
|
|
</dd>
|
|
<dt class="bold">server-name</dt>
|
|
<dd>An SQL identifier that designates an application server. The identifier must
|
|
start with a letter and must not include lowercase letters or special characters. <a id="idx277" name="idx277"></a>
|
|
</dd>
|
|
<dt class="bold">specific-name</dt><a id="idx278" name="idx278"></a>
|
|
<dd>A qualified or unqualified name that uniquely identifies a procedure
|
|
or function. The qualified form of a <var class="pv">specific-name</var> depends upon the
|
|
naming option. For SQL naming, the qualified form is a <var class="pv">schema-name</var> followed
|
|
by a period (.) and an SQL identifier. For system naming, the qualified form
|
|
is a <var class="pv">schema-name</var> followed by a slash (/) followed by an SQL identifier.
|
|
<p>The unqualified form of a <var class="pv">specific-name</var> is an SQL identifier. The
|
|
unqualified form is implicitly qualified based on the rules specified in <a href="rbafzmstch2nam.htm#qualun">Qualification of unqualified object names</a>.</p>
|
|
</dd>
|
|
<dt class="bold">SQL-descriptor-name</dt><a id="idx279" name="idx279"></a>
|
|
<dd>A variable name or character or graphic string constant that designates
|
|
an SQL descriptor that was allocated using the ALLOCATE DESCRIPTOR statement.
|
|
<p>If a variable is used to designate the SQL descriptor:</p>
|
|
<ul>
|
|
<li>The variable must not be a CLOB or DBCLOB.</li>
|
|
<li>If the variable is a graphic string, it must be a UTF-16 or UCS-2 graphic
|
|
string.</li>
|
|
<li>The length of the contents of the variable must not exceed the maximum
|
|
length for an <var class="pv">SQL-descriptor-name</var>.</li>
|
|
<li>An indicator variable must not be specified. The form <var class="pv">:host-variable:indicator-variable</var> is not allowed.</li>
|
|
<li>The contents of the variable are case-sensitive and are not converted
|
|
to uppercase.</li></ul><p class="indatacontent">Leading and trailing blanks are trimmed from the variable or string.
|
|
See <a href="rbafzmstch2refvar.htm#ch2host">References to host variables</a> for a description of a variable.</p>
|
|
<p>If a string
|
|
constant is used to designate the SQL descriptor, the length of the constant
|
|
must not exceed the maximum length for an <var class="pv">SQL-descriptor-name</var>.</p>
|
|
</dd>
|
|
<dt class="bold">SQL-label</dt><a id="idx280" name="idx280"></a>
|
|
<dd>An unqualified name that designates a label in an SQL procedure, SQL
|
|
function, or trigger body. An <var class="pv">SQL-label</var> is an SQL identifier.
|
|
</dd>
|
|
<dt class="bold">SQL-parameter-name</dt><a id="idx281" name="idx281"></a>
|
|
<dd>A qualified or unqualified name that designates a parameter in an SQL
|
|
routine body. The unqualified form of an <var class="pv">SQL-parameter-name</var> is an
|
|
SQL identifier. The qualified form is a <var class="pv">procedure-name</var> followed by
|
|
a period (.) and an SQL identifier.
|
|
</dd>
|
|
<dt class="bold">SQL-variable-name</dt><a id="idx282" name="idx282"></a>
|
|
<dd>A qualified or unqualified name that designates a variable in an SQL
|
|
routine body. The unqualified form of an <var class="pv">SQL-variable-name</var> is an
|
|
SQL identifier. The qualified form is an <var class="pv">SQL-label</var> followed by a
|
|
period (.) and an SQL identifier.
|
|
</dd>
|
|
<dt class="bold">statement-name</dt><a id="idx283" name="idx283"></a>
|
|
<dd>An SQL identifier that designates a prepared SQL statement.
|
|
</dd>
|
|
<dt class="bold">system-column-name</dt><a id="idx284" name="idx284"></a>
|
|
<dd>An unqualified name that designates the i5/OS column name of a table
|
|
or a view. A <var class="pv">system-column-name</var> is a system identifier. <var class="pv">System-column-names</var> can be delimited identifiers, but the characters within the delimiters
|
|
must not include lowercase letters or special characters.
|
|
</dd>
|
|
<dt class="bold">system-object-name</dt><a id="idx285" name="idx285"></a>
|
|
<dd>An unqualified name that designates the i5/OS name of a table, view,
|
|
index, sequence, or alias. A <var class="pv">system-object-name</var> is a system identifier.
|
|
<p>If the unqualified name of the table, view, index, sequence, or alias is a
|
|
valid system identifier, the <var class="pv">system-object-name</var> of the table, view,
|
|
index, sequence, or alias is the unqualified name of the table, view, index,
|
|
sequence, or alias.</p>
|
|
</dd>
|
|
<dt class="bold">table-name</dt><a id="idx286" name="idx286"></a>
|
|
<dd>A qualified or unqualified name that designates a table. The qualified
|
|
form of a <var class="pv">table-name</var> depends upon the naming option. For SQL naming,
|
|
the qualified form is a <var class="pv">schema-name</var> followed by a period (.) and
|
|
an SQL identifier. For system naming, the qualified form is a <var class="pv">schema-name</var> followed by a slash (/) followed by an SQL identifier.
|
|
<p>The unqualified
|
|
form of a <var class="pv">table-name</var> is an SQL identifier. The unqualified form is
|
|
implicitly qualified based on the rules specified in <a href="rbafzmstch2nam.htm#qualun">Qualification of unqualified object names</a>.</p>
|
|
<p>A <var class="pv">table-name</var> can specify either the name of the table or the
|
|
system object name of the table.</p>
|
|
</dd>
|
|
<dt class="bold">trigger-name</dt><a id="idx287" name="idx287"></a>
|
|
<dd>A qualified or unqualified name that designates a trigger on a table.
|
|
The qualified form of a <var class="pv">trigger-name</var> depends on the naming option.
|
|
For SQL naming, the qualified form is a <var class="pv">schema-name</var> followed by a
|
|
period (.) and a system identifier. For system naming, the qualified form
|
|
is a <var class="pv">schema-name</var> followed by a slash (/) followed by an SQL identifier.
|
|
<p>The unqualified form of a <var class="pv">trigger-name</var> is an SQL identifier. The
|
|
unqualified form is implicitly qualified based on the rules specified in <a href="rbafzmstch2nam.htm#qualun">Qualification of unqualified object names</a>.</p>
|
|
</dd>
|
|
<dt class="bold">version-id</dt>
|
|
<dd>An identifier of 1 to 64 characters that is assigned to a package when
|
|
the package is created. A <var class="pv">version-id</var> is only assigned when packages
|
|
are created from a server other than DB2 UDB for iSeries.
|
|
</dd>
|
|
<dt class="bold">view-name</dt><a id="idx288" name="idx288"></a>
|
|
<dd>A qualified or unqualified name that designates a view. The qualified
|
|
form of a <var class="pv">view-name</var> depends upon the naming option. For SQL naming,
|
|
the qualified form is a <var class="pv">schema-name</var> followed by a period (.) and
|
|
an SQL identifier. For system naming, the qualified form is a <var class="pv">schema-name</var> followed by a slash (/) followed by an SQL identifier.
|
|
<p>The unqualified
|
|
form of a <var class="pv">view-name</var> is an SQL identifier. The unqualified form is
|
|
implicitly qualified based on the rules specified in <a href="rbafzmstch2nam.htm#qualun">Qualification of unqualified object names</a>.</p>
|
|
<p>A <var class="pv">view-name</var> can specify either the name of the view or the
|
|
system object name of the view.</p>
|
|
</dd>
|
|
</dl>
|
|
<p></p>
|
|
<a name="bable1"></a>
|
|
<table id="bable1" width="100%" summary="" border="1" frame="border" rules="rows">
|
|
<caption>Table 2. Identifier Length Limits (in bytes)</caption>
|
|
<thead valign="bottom">
|
|
<tr>
|
|
<th id="wq69" width="66%" align="left" valign="bottom">Identifier Type <a id="idx289" name="idx289"></a> <a id="idx290" name="idx290"></a></th>
|
|
<th id="wq70" width="33%" align="left" valign="bottom">Maximum Length</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody valign="top">
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest authorization name<sup class="fn"><a href="rbafzmstch2nam.htm#authidln">17</a></sup></td>
|
|
<td align="left" valign="top" headers="wq70">10</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest condition name</td>
|
|
<td align="left" valign="top" headers="wq70">128</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest correlation name</td>
|
|
<td align="left" valign="top" headers="wq70">128</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest cursor name</td>
|
|
<td align="left" valign="top" headers="wq70">18</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest external program name (unqualified
|
|
form)<sup class="fn"><a href="rbafzmstch2nam.htm#rexln">18</a></sup></td>
|
|
<td align="left" valign="top" headers="wq70">10</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest external program name (string form)</td>
|
|
<td align="left" valign="top" headers="wq70">279</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest host identifier</td>
|
|
<td align="left" valign="top" headers="wq70">64</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest partition name</td>
|
|
<td align="left" valign="top" headers="wq70">10</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest savepoint name</td>
|
|
<td align="left" valign="top" headers="wq70">128</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest schema name</td>
|
|
<td align="left" valign="top" headers="wq70">10</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest server name</td>
|
|
<td align="left" valign="top" headers="wq70">18</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest SQL-descriptor-name</td>
|
|
<td align="left" valign="top" headers="wq70">128</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest SQL label</td>
|
|
<td align="left" valign="top" headers="wq70">128</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest statement name</td>
|
|
<td align="left" valign="top" headers="wq70">18</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest unqualified alias name</td>
|
|
<td align="left" valign="top" headers="wq70">128</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest unqualified column name</td>
|
|
<td align="left" valign="top" headers="wq70">128</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest unqualified constraint name</td>
|
|
<td align="left" valign="top" headers="wq70">128</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest unqualified distinct type name</td>
|
|
<td align="left" valign="top" headers="wq70">128</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest unqualified function name</td>
|
|
<td align="left" valign="top" headers="wq70">128</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest unqualified index name</td>
|
|
<td align="left" valign="top" headers="wq70">128</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest unqualified nodegroup name</td>
|
|
<td align="left" valign="top" headers="wq70">10</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest unqualified package name</td>
|
|
<td align="left" valign="top" headers="wq70">10</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest package version-id</td>
|
|
<td align="left" valign="top" headers="wq70">64</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest unqualified parameter name</td>
|
|
<td align="left" valign="top" headers="wq70">128</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest unqualified procedure name</td>
|
|
<td align="left" valign="top" headers="wq70">128</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest unqualified sequence name</td>
|
|
<td align="left" valign="top" headers="wq70">128</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest unqualified specific name</td>
|
|
<td align="left" valign="top" headers="wq70">128</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest unqualified SQL parameter name</td>
|
|
<td align="left" valign="top" headers="wq70">128</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest unqualified SQL variable name</td>
|
|
<td align="left" valign="top" headers="wq70">128</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest unqualified system column name</td>
|
|
<td align="left" valign="top" headers="wq70">10</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest unqualified system object name</td>
|
|
<td align="left" valign="top" headers="wq70">10</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest unqualified table and view name</td>
|
|
<td align="left" valign="top" headers="wq70">128</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq69">Longest unqualified trigger name</td>
|
|
<td align="left" valign="top" headers="wq70">128</td>
|
|
</tr>
|
|
</tbody>
|
|
</table><p class="indatacontent"> </p>
|
|
<a name="path"></a>
|
|
<h3 id="path"><a href="rbafzmst02.htm#ToC_89">SQL path</a></h3><a id="idx291" name="idx291"></a><a id="idx292" name="idx292"></a><a id="idx293" name="idx293"></a>
|
|
<p>The <span class="italic">SQL path</span> is an ordered list of schema names.
|
|
The database manager uses the path to resolve the schema name for unqualified
|
|
distinct type names (both built-in types and distinct types), function names,
|
|
and procedure names that appear in any context other than as the main object
|
|
of a CREATE, DROP, COMMENT, GRANT or REVOKE statement. Searching through the
|
|
path from left to right, the database manager implicitly qualifies the object name with
|
|
the first schema name in the path that contains the same object with the same
|
|
unqualified name. For procedures, the database manager selects a matching procedure name
|
|
only if the number of parameters is also the same. For functions, the database manager uses
|
|
a process called function resolution in conjunction with the SQL path to determine
|
|
which function to choose because several functions with the same name can
|
|
reside in a schema. (For details, see <a href="rbafzmstch2function.htm#funcres">Function resolution</a>.)</p><a id="idx294" name="idx294"></a><a id="idx295" name="idx295"></a>
|
|
<p>For example, if the SQL path is SMITH, XGRAPHIC, QSYS, QSYS2 and an unqualified
|
|
distinct type name MYTYPE was specified, the database manager looks for MYTYPE first in
|
|
schema SMITH, then XGRAPHIC, and then QSYS and QSYS2.</p>
|
|
<p>The path used is determined as follows: </p>
|
|
<ul>
|
|
<li>For all static SQL statements (except for a CALL <span class="italic">variable</span> statement), the path used is the value of the SQLPATH parameter
|
|
on the CRTSQLxxx command. The SQLPATH can also be set using the SET OPTION
|
|
statement.</li>
|
|
<li>For dynamic SQL statements (and for a CALL <span class="italic">variable</span> statement), the path used is the value of the CURRENT PATH special
|
|
register. For more information about the CURRENT PATH special register, see <a href="rbafzmstspecreg.htm#curpath">CURRENT PATH</a>.</li></ul><p class="indatacontent">If the SQL path is not explicitly specified, the SQL path is the system
|
|
path followed by the authorization ID of the statement.</p>
|
|
<p>For more information on the SQL path for dynamic SQL, see <a href="rbafzmstspecreg.htm#curpath">CURRENT PATH</a>.</p>
|
|
<a name="qualun"></a>
|
|
<h3 id="qualun"><a href="rbafzmst02.htm#ToC_90">Qualification of unqualified object names</a></h3><a id="idx296" name="idx296"></a>
|
|
<p>Unqualified object names are implicitly qualified. The rules for qualifying
|
|
a name differ depending on the type of object that the name identifies.</p>
|
|
<a name="qualun1"></a>
|
|
<h4 id="qualun1">Unqualified alias, constraint, external program, index, nodegroup,
|
|
package, sequence, table, trigger, and view names</h4>
|
|
<p>Unqualified alias, constraint, external program, index, nodegroup, package, <span>sequence</span>, table, trigger, and view names are implicitly qualified by
|
|
the <var class="pv">default schema</var>. The <var class="pv">default schema</var> is specified as follows:
|
|
</p>
|
|
<ul>
|
|
<li>For static SQL statements:
|
|
<ul>
|
|
<li>If the DFTRDBCOL parameter is specified on the CRTSQLxxx command (or with
|
|
the SET OPTION statement), the <var class="pv">default schema</var> is the <var class="pv">schema-name</var> that is specified for that parameter.</li>
|
|
<li>In all other cases, the <var class="pv">default schema</var> is based on the naming
|
|
convention.
|
|
<ul>
|
|
<li>For SQL naming, the <var class="pv">default schema</var> is the authorization identifier
|
|
of the statement.</li>
|
|
<li>For system naming, the <var class="pv">default schema</var> is the job library list
|
|
(*LIBL).</li></ul></li></ul></li>
|
|
<li>For dynamic SQL statements the <var class="pv">default schema</var> depends on whether
|
|
or not a <var class="pv">default schema</var> has been explicitly specified. The mechanism
|
|
for explicitly specifying this depends on the interface used to dynamically
|
|
prepare and execute SQL statements.
|
|
<ul>
|
|
<li>If a <var class="pv">default schema</var> is not explicitly specified:
|
|
<ul>
|
|
<li>For SQL naming, the <var class="pv">default schema</var> is the run-time authorization
|
|
identifier.</li>
|
|
<li>For system naming, the <var class="pv">default schema</var> is the job library list
|
|
(*LIBL).</li></ul></li>
|
|
<li>The <var class="pv">default schema</var> is explicitly specified through the following
|
|
interfaces:
|
|
<a name="dftcol1"></a>
|
|
<table id="dftcol1" width="90%" summary="" border="1" frame="border" rules="rows">
|
|
<caption>Table 3. Default Schema Interfaces</caption>
|
|
<thead valign="bottom">
|
|
<tr>
|
|
<th id="wq71" width="40%" align="left" valign="bottom">SQL Interface <a id="idx297" name="idx297"></a><a id="idx298" name="idx298"></a></th>
|
|
<th id="wq72" width="60%" align="left" valign="bottom">Specification</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody valign="top">
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq71">Embedded SQL</td>
|
|
<td align="left" valign="top" headers="wq72">DFTRDBCOL parameter and DYNDFTCOL(*YES) on
|
|
the Create SQL Program (CRTSQLxxx) and Create SQL Package (CRTSQLPKG) commands.
|
|
The SET OPTION statement can also be used to set the DFTRDBCOL and DYNDFTCOL
|
|
values.
|
|
<div class="lines"><br />
|
|
</div>(For more information about CRTSQLxxx commands, see
|
|
the <a href="../rzajp/rzajpkickoff.htm">Embedded SQL Programming</a> book.)</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq71">Run SQL Statements</td>
|
|
<td align="left" valign="top" headers="wq72">DFTRDBCOL parameter on the Run SQL Statements
|
|
(RUNSQLSTM) command.
|
|
<div class="lines"><br />
|
|
</div>(For more information about the RUNSQLSTM
|
|
command, see the <a href="../sqlp/rbafykickoff.htm">SQL Programming</a> book.)</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq71">Call Level Interface (CLI) on the server</td>
|
|
<td align="left" valign="top" headers="wq72">SQL_ATTR_DEFAULT_LIB or SQL_ATTR_DBC_DEFAULT_LIB
|
|
environment or connection variables
|
|
<div class="lines"><br />
|
|
</div>(For more information about
|
|
CLI, see the <a href="../cli/rzadpkickoff.htm">SQL Call Level Interfaces (ODBC)</a> book.)</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq71">JDBC or SQLJ on the server using IBM® Developer Kit for Java</td>
|
|
<td align="left" valign="top" headers="wq72">libraries property object
|
|
<div class="lines"><br />
|
|
</div>(For
|
|
more information about JDBC and SQLJ, see the <a href="../rzaha/whatitis.htm">IBM Developer Kit
|
|
for Java</a> topic in the iSeries Information Center.)</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq71">ODBC on a client using the iSeries Access Family ODBC Driver</td>
|
|
<td align="left" valign="top" headers="wq72">SQL Default Library in ODBC Setup
|
|
<div class="lines"><br />
|
|
</div>(For
|
|
more information about ODBC, see the <a href="../rzahg/rzahgicia.htm">iSeries Access</a> category
|
|
in the iSeries Information Center.)</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq71">JDBC on a client using the IBM Toolbox for Java</td>
|
|
<td align="left" valign="top" headers="wq72">SQL Default Library in JDBC Setup
|
|
<div class="lines"><br />
|
|
</div>(For
|
|
more information about JDBC, see the <a href="../rzahg/rzahgicia.htm">iSeries Access</a> category
|
|
in the iSeries Information Center.)
|
|
<div class="lines"><br />
|
|
</div>(For more information about the IBM Toolbox for Java,
|
|
see <a href="../rzahh/page1.htm">IBM Toolbox for Java</a> topic in the iSeries Information Center.)</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq71">OLE DB on a client using the iSeries Access Family OLE DB
|
|
Provider</td>
|
|
<td align="left" valign="top" headers="wq72">Default Collection in Connection Object Properties
|
|
<div class="lines"><br />
|
|
</div>(For
|
|
more information about ODBC, see the <a href="../rzahg/rzahgicia.htm">iSeries Access</a> category
|
|
in the iSeries Information Center.)</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq71">All interfaces</td>
|
|
<td align="left" valign="top" headers="wq72">SET SCHEMA or QSQCHGDC (Change Dynamic Default
|
|
Collection) API
|
|
<div class="lines"><br />
|
|
</div>(For more information about QSQCHGDC, see the <a href="../apis/file1.htm">File APIs category</a> in the iSeries Information Center.)</td>
|
|
</tr>
|
|
</tbody>
|
|
</table></li></ul></li></ul>
|
|
<a name="qualun2"></a>
|
|
<h4 id="qualun2">Unqualified function, procedure, specific, and distinct type names</h4>
|
|
<p>The qualification of data type (both built-in types and distinct types),
|
|
function, procedure, and specific names depends on the SQL statement in which
|
|
the unqualified name appears: </p>
|
|
<ul>
|
|
<li>If an unqualified name is the main object of a CREATE, COMMENT, DROP,
|
|
GRANT, or REVOKE statement, the name is implicitly qualified using the same
|
|
rules as for qualifying unqualified table names (See <a href="rbafzmstch2nam.htm#qualun1">Unqualified alias, constraint, external program, index, nodegroup,
|
|
package, sequence, table, trigger, and view names</a>).</li>
|
|
<li>Otherwise, the implicit schema name is determined as follows:
|
|
<ul>
|
|
<li>For distinct type names, the database manager searches the SQL path and selects the
|
|
first schema in the path such that the data type exists in the schema.</li>
|
|
<li>For procedure names, the database manager searches the SQL path and selects the first
|
|
schema in the path such that the schema contains a procedure with the same
|
|
name and number of parameters.</li>
|
|
<li>For function names and for specific names specified for sourced functions, the database manager uses
|
|
the SQL path in conjunction with function resolution, as described under <a href="rbafzmstch2function.htm#funcres">Function resolution</a>.</li></ul></li></ul>
|
|
<a name="wq73"></a>
|
|
<h3 id="wq73"><a href="rbafzmst02.htm#ToC_93">SQL names and system names: special considerations</a></h3><a id="idx299" name="idx299"></a>
|
|
<p>The CL command Override Database File (OVRDBF) can be specified to override
|
|
an SQL or system name with another object name for local data manipulation
|
|
SQL statements. Overrides are ignored for data definition SQL statements and
|
|
data manipulation SQL statements executing at a remote relational database.
|
|
See the <a href="../dm/rbal3kickoff.htm">File Management</a> book for more information about
|
|
the override function.</p>
|
|
<hr /><div class="fnnum"><a id="authidln" name="authidln">17</a>.</div>
|
|
<div class="fntext">As an application requester, iSeries™ can send
|
|
an authorization name of up to 255 bytes.</div><div class="fnnum"><a id="rexln" name="rexln">18</a>.</div>
|
|
<div class="fntext">For REXX procedures,
|
|
the limit is 33.</div>
|
|
<br />
|
|
<hr /><br />
|
|
[ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzmstch2iden.htm">Previous Page</a> | <a href="rbafzmstch2alias.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>
|