113 lines
6.6 KiB
HTML
113 lines
6.6 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 lang="en-us" xml:lang="en-us">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<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="DC.Type" content="reference" />
|
||
|
<meta name="DC.Title" content="Use embedded CALL statement where no procedure definition exists" />
|
||
|
<meta name="abstract" content="A static CALL statement without a corresponding CREATE PROCEDURE statement is processed with the following rules." />
|
||
|
<meta name="description" content="A static CALL statement without a corresponding CREATE PROCEDURE statement is processed with the following rules." />
|
||
|
<meta name="DC.subject" content="stored procedures, invoking using embedded CALL, CALL statement, stored procedure, statements, CALL, examples, embedded CALL, invoking stored procedures, example, embedded CALL, invoking stored procedures, where no CREATE PROCEDURE exists" />
|
||
|
<meta name="keywords" content="stored procedures, invoking using embedded CALL, CALL statement, stored procedure, statements, CALL, examples, embedded CALL, invoking stored procedures, example, embedded CALL, invoking stored procedures, where no CREATE PROCEDURE exists" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafyinvokeproc.htm" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="rbafystatwo" />
|
||
|
<meta name="DC.Language" 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. -->
|
||
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
||
|
<title>Use embedded CALL statement where no procedure definition exists</title>
|
||
|
</head>
|
||
|
<body id="rbafystatwo"><a name="rbafystatwo"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Use embedded CALL statement where no procedure definition exists</h1>
|
||
|
<div><p>A static CALL statement without a corresponding CREATE PROCEDURE
|
||
|
statement is processed with the following rules.</p>
|
||
|
<div class="section"><ul><li>All host variable arguments are treated as INOUT type parameters.</li>
|
||
|
<li>The CALL type is GENERAL (no indicator argument is passed).</li>
|
||
|
<li>The program to call is determined based on the procedure name specified
|
||
|
on the CALL, and, if necessary, the naming convention.</li>
|
||
|
<li>The language of the program to call is determined based on information
|
||
|
retrieved from the system about the program.</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div class="section"><h4 class="sectiontitle">Example: Embedded CALL statement where no procedure definition
|
||
|
exists</h4><p>The following is a PL/I example of an embedded CALL statement
|
||
|
where no procedure definition exists: </p>
|
||
|
<pre>DCL HV2 <strong>CHAR</strong>(10);
|
||
|
:
|
||
|
EXEC SQL <strong>CALL</strong> P2 (:HV2);
|
||
|
:
|
||
|
</pre>
|
||
|
</div>
|
||
|
<div class="section"><p>When the CALL statement is issued, DB2<sup>®</sup> SQL for <span class="keyword">iSeries™</span> attempts
|
||
|
to find the program based on standard SQL naming conventions. For the above
|
||
|
example, assume that the naming option of *SYS (system naming) is used and
|
||
|
that a DFTRDBCOL parameter was not specified on the CRTSQLPLI command. In
|
||
|
this case, the library list is searched for a program named P2. Since the
|
||
|
call type is GENERAL, no additional argument is passed to the program for
|
||
|
indicator variables.</p>
|
||
|
</div>
|
||
|
<div class="section"> <div class="note"><span class="notetitle">Note:</span> If an indicator variable is specified on the CALL statement
|
||
|
and its value is less than zero when the CALL statement is executed, an error
|
||
|
results because there is no way to pass the indicator to the procedure.</div>
|
||
|
</div>
|
||
|
<div class="section"><p>Assuming program P2 is found in the library list, the contents
|
||
|
of host variable HV2 are passed in to the program on the CALL and the argument
|
||
|
returned from P2 is mapped back to the host variable after P2 has completed
|
||
|
execution.</p>
|
||
|
</div>
|
||
|
<div class="section"><div class="p">For numeric constants passed on a CALL statement, the following
|
||
|
rules apply: <ul><li>All integer constants are passed as fullword binary integers. </li>
|
||
|
<li>All decimal constants are passed as packed decimal values. Precision and
|
||
|
scale are determined based on the constant value. For instance, a value of
|
||
|
123.45 is passed as a packed decimal(5,2). Likewise, a value of 001.01 is
|
||
|
also passed with a precision of 5 and a scale of 2. </li>
|
||
|
<li>All floating point constants are passed as double-precision floating point.</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="section"><div class="p">Special registers specified on a dynamic CALL statement are passed
|
||
|
as follows:<dl><dt class="dlterm">CURRENT DATE </dt>
|
||
|
<dd>Passed as a 10-byte character string in ISO format.</dd>
|
||
|
<dt class="dlterm">CURRENT DEGREE</dt>
|
||
|
<dd>Passed as a 5-byte character string.</dd>
|
||
|
<dt class="dlterm">CURRENT TIME</dt>
|
||
|
<dd>Passed as an 8-byte character string in ISO format.</dd>
|
||
|
<dt class="dlterm">CURRENT TIMEZONE</dt>
|
||
|
<dd>Passed as a packed decimal number with a precision of 6 and a scale of
|
||
|
0. </dd>
|
||
|
<dt class="dlterm">CURRENT TIMESTAMP</dt>
|
||
|
<dd>Passed as a 26-byte character string in IBM SQL format.</dd>
|
||
|
<dt class="dlterm">CURRENT SCHEMA </dt>
|
||
|
<dd>Passed as an 128-byte varying length character string.</dd>
|
||
|
<dt class="dlterm">CURRENT SERVER</dt>
|
||
|
<dd>Passed as an 18-byte varying length character string.</dd>
|
||
|
<dt class="dlterm">USER</dt>
|
||
|
<dd>Passed as an 18-byte varying length character string.</dd>
|
||
|
<dt class="dlterm">CURRENT PATH </dt>
|
||
|
<dd>Passed as a 3483-byte varying length character string. </dd>
|
||
|
<dt class="dlterm">SESSION_USER</dt>
|
||
|
<dd>Passed as a 128-byte varying length character string.</dd>
|
||
|
<dt class="dlterm">SYSTEM_USER</dt>
|
||
|
<dd>Passed as a 128-byte varying length character string.</dd>
|
||
|
</dl>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafyinvokeproc.htm" title="The SQL CALL statement calls a stored procedure.">Invoke a stored procedure</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|