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

187 lines
10 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="CALL statement, SQL-control-statement,
SQL statements, in INSERT statement, DLVALUE function, ALTER TABLE statement,
cast-function, in CALL statement, constant, SQL-variable-name,
SQL-parameter-name" />
<title>CALL statement</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="callstmt"></a>
<h2 id="callstmt"><a href="rbafzmst02.htm#ToC_1415">CALL statement</a></h2><a id="idx3330" name="idx3330"></a><a id="idx3331" name="idx3331"></a>
<p>The CALL statement invokes a procedure. The syntax of CALL in an SQL function,
SQL procedure, or SQL trigger is a subset of what is supported as a CALL statement
in other contexts. See <a href="rbafzmstcallsta.htm#callsta">CALL</a> for details.</p>
<a name="wq1853"></a>
<h3 id="wq1853"><a href="rbafzmst02.htm#ToC_1416">Syntax</a></h3>
<a href="rbafzmstcallstmt.htm#synccall"><img src="c.gif" alt="Click to skip syntax diagram" /></a>
<pre class="cgraphic"><span><img src="c.gif" alt="Read syntax diagram" longdesc="rbafzmstsyn408.htm"
border="0" /></span><a href="#skipsyn-407"><img src="c.gif" alt="Skip visual syntax diagram"
border="0" /></a>>>-+--------+--CALL--<span class="italic">procedure-name</span>--<span class="italic">argument-list</span>------------->&lt;
'-<span class="italic">label:</span>-'
argument-list:
|--(--+----------------------------------------------------------+--)--|
| .-,----------------------------------------------------. |
| V | |
'---+-<span class="italic">SQL-variable-name</span>--------------------------------+-+-'
+-<span class="italic">SQL-parameter-name</span>-------------------------------+
+-<span class="italic">constant</span>-----------------------------------------+
+-<span class="italic">NULL</span>---------------------------------------------+
+-<span class="italic">special-register</span>---------------------------------+
+-DLVALUE--(--<span class="italic">arguments</span>--)-------------------------+
'-<span class="italic">cast-function-name</span>--(--+-<span class="italic">SQL-variable-name</span>--+--)-'
+-<span class="italic">SQL-parameter-name</span>-+
'-<span class="italic">constant</span>-----------'
</pre>
<a name="skipsyn-407" id="skipsyn-407"></a>
<a name="synccall"></a>
<h3 id="synccall"><a href="rbafzmst02.htm#ToC_1417">Description</a></h3>
<dl class="parml">
<dt class="bold"><span class="italic">label</span></dt>
<dd>Specifies the label for the CALL statement. The label name
cannot be the same as another label within the same scope. For more information,
see <a href="rbafzmstsqlprocstmt.htm#psscope">Labels</a>.
</dd>
<dt class="bold"><span class="italic">procedure-name</span></dt>
<dd>Identifies the procedure to call. The <span class="italic">procedure-name</span> must identify a procedure that exists at the current server.
</dd>
<dt class="bold">argument-list</dt>
<dd>Specifies the arguments of the procedure. The number of arguments specified
must be the same as the number of parameters defined by that procedure.
<dl class="parml">
<dt class="bold"><span class="italic">SQL-variable-name</span></dt>
<dd>Specifies an SQL variable as an argument to the procedure.
</dd>
<dt class="bold"><span class="italic">SQL-parameter-name</span></dt>
<dd>Specifies an SQL parameter as an argument to the procedure.
</dd>
<dt class="bold">constant</dt>
<dd>Specifies a constant as an argument to the procedure.
</dd>
<dt class="bold">NULL</dt>
<dd>Specifies the null value as an argument to the procedure.
</dd>
<dt class="bold">special-register</dt>
<dd>Specifies a special register as an argument to the procedure.
</dd>
<dt class="bold">DLVALUE(<var class="pv">arguments</var>)</dt><a id="idx3332" name="idx3332"></a>
<dd>Specifies the value for the parameter is the value resulting from a
DLVALUE scalar function. A DLVALUE scalar function can only be specified for
a DataLink parameter. The DLVALUE function requires a link value on insert
(scheme, server, and path/file). The first argument of DLVALUE must be a constant,
variable, or a typed parameter marker (CAST(? AS data-type)). The second and
third arguments of DLVALUE must be constants or variables.
</dd>
<dt class="bold"><span class="bold"><var class="pv">cast-function-name</var></span> </dt><a id="idx3333" name="idx3333"></a>
<dd>This form of an argument can only be used with parameters defined as
a distinct type, BINARY, VARBINARY, BLOB, CLOB, DBCLOB, DATE, TIME or TIMESTAMP
data types. The following table describes the allowed uses of these <var class="pv">cast-functions</var>.
<a name="wq1854"></a>
<table id="wq1854" width="100%" summary="" border="1" frame="border" rules="none">
<thead valign="bottom">
<tr>
<th id="wq1855" width="47%" align="left" valign="top">Parameter Type</th>
<th id="wq1856" width="52%" align="left" valign="top">Cast Function Name</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="left" valign="top" headers="wq1855">Distinct type N based on a BINARY, VARBINARY,
BLOB, CLOB, or DBCLOB</td>
<td align="left" valign="top" headers="wq1856">BINARY, VARBINARY, BLOB, CLOB, or DBCLOB *</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq1855">Distinct type N based on a DATE, TIME, or
TIMESTAMP</td>
<td align="left" valign="top" headers="wq1856">DATE, TIME, or TIMESTAMP *</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq1855">BINARY, VARBINARY, BLOB, CLOB, or DBCLOB</td>
<td align="left" valign="top" headers="wq1856">BINARY, VARBINARY, BLOB, CLOB, or DBCLOB *</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq1855">DATE, TIME, or TIMESTAMP</td>
<td align="left" valign="top" headers="wq1856">DATE, TIME, or TIMESTAMP *</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" headers="wq1855 wq1856">
<a name="wq1857"></a>
<div class="notetitle" id="wq1857">Notes:</div>
<div class="notebody">
<p>* The name of the function must
match the name of the data type (or the source type of the distinct type)
with an implicit or explicit schema name of QSYS2.</p></div></td>
</tr>
</tbody>
</table>
<dl class="parml">
<dt class="bold"><var class="pv">constant</var> </dt><a id="idx3334" name="idx3334"></a>
<dd>Specifies a constant as the argument. The constant must conform to the
rules of a constant for the source type of the distinct type or for the data
type if not a distinct type. For BINARY, VARBINARY, BLOB, CLOB, DBCLOB, DATE,
TIME, and TIMESTAMP functions, the constant must be a string constant.
</dd>
<dt class="bold"><span class="italic">SQL-variable-name</span> </dt><a id="idx3335" name="idx3335"></a>
<dd>Specifies an SQL variable as the argument. The SQL variable must conform
to the rules of a constant for the source type of the distinct type or for
the data type if not a distinct type.
</dd>
<dt class="bold"><span class="italic">SQL-parameter-name</span> </dt><a id="idx3336" name="idx3336"></a>
<dd>Specifies an SQL parameter as the argument. The SQL parameter must conform
to the rules of a constant for the source type of the distinct type or for
the data type if not a distinct type.
</dd>
</dl>
</dd>
</dl>
</dd>
</dl>
<a name="wq1858"></a>
<h3 id="wq1858"><a href="rbafzmst02.htm#ToC_1418">Notes</a></h3>
<p><span class="bold">Rules for arguments to OUT and INOUT parameters:</span> Each
OUT or INOUT parameter must be specified as an SQL parameter or SQL variable.</p>
<p><span class="bold">Special registers:</span> The initial value of a special
register in a procedure is inherited from the caller of the procedure. A value
assigned to a special register within the procedure is used for the entire
SQL procedure and will be inherited by any procedure subsequently called from
that procedure. When a procedure returns to its caller, the special registers
are restored to the original values of the caller.</p>
<p><span class="bold">Related information:</span> See <a href="rbafzmstcallsta.htm#callsta">CALL</a> for
more information.</p>
<a name="wq1859"></a>
<h3 id="wq1859"><a href="rbafzmst02.htm#ToC_1419">Example</a></h3>
<p>Call procedure<span class="italic"> proc1</span> and pass SQL variables as
parameters.</p>
<pre class="xmp"> <span class="bold">CALL</span> proc1(v_empno, v_salary)
</pre>
<hr /><br />
[ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzmstassignstmt.htm">Previous Page</a> | <a href="rbafzmstcasestmt.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>