167 lines
9.8 KiB
HTML
167 lines
9.8 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="SET PATH statement, SET PATH, SQL statements,
|
|
SQL path, current path special register, system path" />
|
|
<title>SET PATH</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="setpath"></a>
|
|
<h2 id="setpath"><a href="rbafzmst02.htm#ToC_1320">SET PATH</a></h2><a id="idx3186" name="idx3186"></a><a id="idx3187" name="idx3187"></a><a id="idx3188" name="idx3188"></a><a id="idx3189" name="idx3189"></a>
|
|
<p>The SET PATH statement changes the value of the CURRENT PATH special register.</p>
|
|
<a name="wq1775"></a>
|
|
<h3 id="wq1775"><a href="rbafzmst02.htm#ToC_1321">Invocation</a></h3>
|
|
<p>This statement can be embedded in an application program or issued interactively.
|
|
It is an executable statement that can be dynamically prepared.</p>
|
|
<a name="wq1776"></a>
|
|
<h3 id="wq1776"><a href="rbafzmst02.htm#ToC_1322">Authorization</a></h3>
|
|
<p>No authorization is required to execute this statement.</p>
|
|
<a name="wq1777"></a>
|
|
<h3 id="wq1777"><a href="rbafzmst02.htm#ToC_1323">Syntax</a></h3>
|
|
<a href="rbafzmstsetpath.htm#synssp"><img src="c.gif" alt="Click to skip syntax diagram" /></a>
|
|
<pre class="cgraphic"><span><img src="c.gif" alt="Read syntax diagram" longdesc="rbafzmstsyn389.htm"
|
|
border="0" /></span><a href="#skipsyn-388"><img src="c.gif" alt="Skip visual syntax diagram"
|
|
border="0" /></a> .-FUNCTION-.
|
|
.-CURRENT--+----------+-. .-=-.
|
|
>>-SET--+-+-----------------------+--PATH-+--+---+-------------->
|
|
'-CURRENT_PATH--------------------'
|
|
|
|
.-,---------------------------------------.
|
|
V |
|
|
>--+---+-<span class="italic">schema-name</span>-------------------------+-+-+-------------><
|
|
| +-SYSTEM PATH-------------------------+ |
|
|
| +-+-<span>SESSION_USER</span>-+--------------------+ |
|
|
| | '-<span>USER</span>---------' | |
|
|
| +-<span>SYSTEM_USER</span>-------------------------+ |
|
|
| | .-FUNCTION-. | |
|
|
| | .-CURRENT--+----------+-. | |
|
|
| +-+-+-----------------------+--PATH-+-+ |
|
|
| | '-CURRENT_PATH--------------------' | |
|
|
| +-<span><span class="italic">variable</span></span>----------------------------+ |
|
|
| '-<span class="italic">string-constant</span>---------------------' |
|
|
'-*LIBL---------------------------------------'
|
|
|
|
</pre>
|
|
<a name="skipsyn-388" id="skipsyn-388"></a>
|
|
<a name="synssp"></a>
|
|
<h3 id="synssp"><a href="rbafzmst02.htm#ToC_1324">Description</a></h3>
|
|
<dl class="parml">
|
|
<dt class="bold"><var class="pv">schema-name</var></dt>
|
|
<dd>Identifies a schema. No validation that the schema exists is made at
|
|
the time the PATH is set. For example, if a <var class="pv">schema-name</var> is misspelled,
|
|
it could affect the way subsequent SQL operates. Although not recommended,
|
|
PATH can be specified as a <var class="pv">schema-name</var> if it is specified as a delimited
|
|
identifier.
|
|
</dd>
|
|
<dt class="bold">SYSTEM PATH</dt><a id="idx3190" name="idx3190"></a>
|
|
<dd>This value is the same as specifying the schema names "QSYS","QSYS2".
|
|
</dd>
|
|
<dt class="bold">SESSION_USER or USER</dt>
|
|
<dd>This value is the SESSION_USER special register.
|
|
</dd>
|
|
<dt class="bold">SYSTEM_USER</dt>
|
|
<dd>This value is the SYSTEM_USER special register.
|
|
</dd>
|
|
<dt class="bold">CURRENT PATH</dt><a id="idx3191" name="idx3191"></a>
|
|
<dd>Specifies the value of the CURRENT PATH special register
|
|
before the execution of this statement. CURRENT PATH is not allowed if the
|
|
current path is *LIBL.
|
|
</dd>
|
|
<dt class="bold"><var class="pv">variable</var></dt>
|
|
<dd>Specifies a variable that contains one or more schema names that are
|
|
separated by commas.
|
|
<p>The variable: </p>
|
|
<ul>
|
|
<li>Must be a CHAR, VARCHAR, UTF-16 or UCS-2 GRAPHIC, or UTF-16 or UCS-2 VARGRAPHIC
|
|
variable. The actual length of the contents of the <var class="pv">variable</var> must not exceed the maximum length of a path.</li>
|
|
<li>Must not be followed by an indicator variable.</li>
|
|
<li>Must not be the null value.</li>
|
|
<li>The list of schema names must be left justified and each schema name conform
|
|
to the rules for forming an ordinary or delimited identifier.</li>
|
|
<li>Each schema name must not contain lowercase letters or characters that
|
|
cannot be specified in an ordinary identifier.</li>
|
|
<li>Must be padded on the right with blanks if the variable is fixed length
|
|
character.</li></ul>
|
|
</dd>
|
|
<dt class="bold"><var class="pv">string-constant</var></dt>
|
|
<dd>A character constant with one or more schema names that are separated
|
|
by commas.
|
|
</dd>
|
|
</dl>
|
|
<a name="wq1778"></a>
|
|
<h3 id="wq1778"><a href="rbafzmst02.htm#ToC_1325">Notes</a></h3>
|
|
<p><span class="bold">Transaction considerations:</span> The SET PATH statement
|
|
is not a commitable operation. ROLLBACK has no effect on the CURRENT PATH.</p>
|
|
<p><span class="bold">Rules for the content of the SQL path:</span> </p>
|
|
<ul>
|
|
<li>A schema name must not appear more than once in the path.</li>
|
|
<li>The number of schemas that can be specified is limited by the total length
|
|
of the CURRENT PATH special register. The special register string is built
|
|
by taking each schema name specified and removing trailing blanks, delimiting
|
|
with double quotes, and separating each schema name by a comma. An error is
|
|
returned if the length of the resulting string exceeds 3483 bytes. A maximum
|
|
of 268 schema names can be represented in the path.</li>
|
|
<li>There is a difference between specifying a single keyword (such as USER,
|
|
or PATH, or CURRENT_PATH) as a single keyword, or as a delimited identifier.
|
|
To indicate that the current value of a special register specified as a single
|
|
keyword should be used in the SQL path, specify the name of the special register
|
|
as a keyword. If the name of the special register is specified as a delimited
|
|
identifier instead (for example, "USER"), it is interpreted as a schema name
|
|
of that value ('USER'). For example, assuming that the current value of the
|
|
USER special register is SMITH, then SET PATH = SYSIBM, USER, "USER" results
|
|
in a CURRENT PATH value of "SYSIBM","SMITH","USER".</li>
|
|
<li>The following rules are used to determine whether a value specified in
|
|
a SET PATH statement is a variable or a <var class="pv">schema-name</var>:
|
|
<ul>
|
|
<li>If <var class="pv">name</var> is the same as a parameter or SQL variable in the SQL
|
|
procedure, <var class="pv">name</var> is interpreted as a parameter or SQL variable, and
|
|
the value in <var class="pv">name</var> is assigned to PATH.</li>
|
|
<li>If <var class="pv">name</var> is not the same as a parameter or SQL variable in the
|
|
SQL procedure, <var class="pv">name</var> is interpreted as <var class="pv">schema-name</var>, and the
|
|
value <var class="pv">name</var> is assigned to PATH.</li></ul></li></ul>
|
|
<p><span class="bold">The System Path:</span> SYSTEM PATH refers to the system
|
|
path for a platform. The schemas QSYS and QSYS2 do not need to be specified.
|
|
If not included in the path, they are implicitly assumed as the last schemas
|
|
(in this case, it is not included in the CURRENT PATH special register).</p>
|
|
<p>The initial value of the CURRENT PATH special register is *LIBL if system
|
|
naming was used for the first SQL statement run in the activation group. The
|
|
initial value is "QSYS","QSYS2", "X" (where X is the value of the USER special
|
|
register) if SQL naming was used for the first SQL statement.</p>
|
|
<p><span class="bold">Using the SQL path:</span> The CURRENT PATH special
|
|
register is used to resolve user-defined distinct types, functions, and procedures
|
|
in dynamic SQL statements. For more information see <a href="rbafzmstch2nam.htm#path">SQL path</a>.</p>
|
|
<a name="wq1779"></a>
|
|
<h3 id="wq1779"><a href="rbafzmst02.htm#ToC_1326">Example</a></h3>
|
|
<p>The following statement sets the CURRENT PATH special register. </p>
|
|
<pre class="xmp"><span class="bold">SET PATH =</span> FERMAT, "McDuff", SYSIBM</pre>
|
|
<p>The following statement retrieves the current value of the SQL path special
|
|
register into the host variable called CURPATH. </p>
|
|
<pre class="xmp">EXEC SQL <span class="bold">VALUES (CURRENT PATH) INTO</span> :CURPATH;</pre>
|
|
<p>The value would be "FERMAT","McDuff","SYSIBM" if set by the previous example.</p>
|
|
<hr /><br />
|
|
[ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzmstsoption.htm">Previous Page</a> | <a href="rbafzmsthsetrs.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>
|