ibm-information-center/dist/eclipse/plugins/i5OS.ic.sqlp_5.4.0.1/rbafyinvokeproc.htm

89 lines
5.9 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 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="Invoke a stored procedure" />
<meta name="abstract" content="The SQL CALL statement calls a stored procedure." />
<meta name="description" content="The SQL CALL statement calls a stored procedure." />
<meta name="DC.subject" content="stored procedures, invoking, CREATE PROCEDURE statement, statements, CREATE PROCEDURE" />
<meta name="keywords" content="stored procedures, invoking, CREATE PROCEDURE statement, statements, CREATE PROCEDURE" />
<meta name="DC.Relation" scheme="URI" content="rbafysproeg.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafyusingcall.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafystatwo.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafycalldrda.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafydynamiccall.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafyexamplecall.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="rbafyinvokeproc" />
<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>Invoke a stored procedure</title>
</head>
<body id="rbafyinvokeproc"><a name="rbafyinvokeproc"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Invoke a stored procedure</h1>
<div><p>The SQL CALL statement calls a stored procedure.</p>
<div class="section"><p>On the CALL statement, the name of the stored procedure and any
arguments are specified. Arguments may be constants, special registers, or
host variables. The external stored procedure specified in the CALL statement
does not need to have a corresponding CREATE PROCEDURE statement. Programs
created by SQL procedures can only be called by invoking the procedure name
specified on the CREATE PROCEDURE statement. </p>
</div>
<div class="section"><p>Although procedures are system program objects, using the CALL
CL command will not typically work to call a procedure. The CALL CL command
does not use the procedure definition to map the input and output parameters,
nor does it pass parameters to the program using the procedure's parameter
style.</p>
</div>
<div class="section"><p>There are three types of CALL statements which need to be addressed
since DB2<sup>®</sup> SQL
for <span class="keyword">iSeries™</span> has different rules
for each type. They are: </p>
<ul><li>Embedded or dynamic CALL statement where a procedure definition exists</li>
<li>Embedded CALL statement where no procedure definition exists</li>
<li>Dynamic CALL statement where no CREATE PROCEDURE exists</li>
</ul>
</div>
<div class="section"><div class="note"><span class="notetitle">Notes:</span> <p>Dynamic here refers to:</p>
<ul><li>A dynamically prepared and executed CALL statement.</li>
<li>A CALL statement issued in an interactive environment (for example, through
STRSQL or Query Manager).</li>
<li>A CALL statement executed in an EXECUTE IMMEDIATE statement.</li>
</ul>
</div>
</div>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="rbafyusingcall.htm">Use CALL statement where procedure definition exists</a></strong><br />
This type of CALL statement reads all the information about the procedure and the argument attributes from the CREATE PROCEDURE catalog definition.</li>
<li class="ulchildlink"><strong><a href="rbafystatwo.htm">Use embedded CALL statement where no procedure definition exists</a></strong><br />
A static CALL statement without a corresponding CREATE PROCEDURE statement is processed with the following rules.</li>
<li class="ulchildlink"><strong><a href="rbafycalldrda.htm">Use embedded CALL statement with an SQLDA</a></strong><br />
In either type of embedded CALL (where a procedure definition may or may not exist), an SQLDA may be passed rather than a parameter list.</li>
<li class="ulchildlink"><strong><a href="rbafydynamiccall.htm">Use dynamic CALL statement where no CREATE PROCEDURE exists</a></strong><br />
The following rules pertain to the processing of a dynamic CALL statement when there is no CREATE PROCEDURE definition.</li>
<li class="ulchildlink"><strong><a href="rbafyexamplecall.htm">Examples of CALL statements</a></strong><br />
These examples show how the arguments of the CALL statement are passed to the procedure for several languages. They also show how to receive the arguments into local variables in the procedure.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafysproeg.htm" title="A procedure (often called a stored procedure) is a program that can be called to perform operations that can include both host language statements and SQL statements. Procedures in SQL provide the same benefits as procedures in a host language.">Stored procedures</a></div>
</div>
</div>
</body>
</html>