84 lines
5.7 KiB
HTML
84 lines
5.7 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="Define an external procedure" />
|
|
<meta name="abstract" content="The CREATE PROCEDURE statement for an external procedure names the procedure, defines the parameters and their attributes, and gives other information about the procedure that the system uses when it calls the procedure." />
|
|
<meta name="description" content="The CREATE PROCEDURE statement for an external procedure names the procedure, defines the parameters and their attributes, and gives other information about the procedure that the system uses when it calls the procedure." />
|
|
<meta name="DC.subject" content="stored procedures, defining external, CREATE PROCEDURE statement, statements, CREATE PROCEDURE, examples, defining stored procedures, with CREATE PROCEDURE" />
|
|
<meta name="keywords" content="stored procedures, defining external, CREATE PROCEDURE statement, statements, CREATE PROCEDURE, examples, defining stored procedures, with CREATE PROCEDURE" />
|
|
<meta name="DC.Relation" scheme="URI" content="rbafysproeg.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="rbafystatwo.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="rbafydfnid" />
|
|
<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>Define an external procedure</title>
|
|
</head>
|
|
<body id="rbafydfnid"><a name="rbafydfnid"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Define an external procedure</h1>
|
|
<div><p>The CREATE PROCEDURE statement for an external procedure names
|
|
the procedure, defines the parameters and their attributes, and gives other
|
|
information about the procedure that the system uses when it calls the procedure.</p>
|
|
<div class="section"><p>Consider the following example: </p>
|
|
<pre> <strong>CREATE PROCEDURE</strong> P1
|
|
(<strong>INOUT</strong> PARM1 <strong>CHAR</strong>(10))
|
|
<strong>EXTERNAL NAME</strong> MYLIB.PROC1
|
|
<strong>LANGUAGE C</strong>
|
|
<strong>GENERAL WITH NULLS</strong>
|
|
</pre>
|
|
</div>
|
|
<div class="section"><p>This CREATE PROCEDURE statement: </p>
|
|
<ul><li>Names the procedure P1</li>
|
|
<li>Defines one parameter which is used both as an input parameter and an
|
|
output parameter. The parameter is a character field of length ten. Parameters
|
|
can be defined to be type IN, OUT, or INOUT. The parameter type determines
|
|
when the values for the parameters get passed to and from the procedure.</li>
|
|
<li>Defines the name of the program which corresponds to the procedure, which
|
|
is PROC1 in MYLIB. MYLIB.PROC1 is the program which is called when the procedure
|
|
is called on a CALL statement.</li>
|
|
<li>Indicates that the procedure P1 (program MYLIB.PROC1) is written in C.
|
|
The language is important since it impacts the types of parameters that can
|
|
be passed. It also affects how the parameters are passed to the procedure
|
|
(for example, for ILE C procedures, a NUL-terminator is passed on character,
|
|
graphic, date, time, and timestamp parameters).</li>
|
|
<li>Defines the CALL type to be GENERAL WITH NULLS. This indicates that the
|
|
parameter for the procedure can possibly contain the NULL value, and therefore
|
|
will like an additional argument passed to the procedure on the CALL statement.
|
|
The additional argument is an array of N short integers, where N is the number
|
|
of parameters that are declared in the CREATE PROCEDURE statement. In this
|
|
example, the array contains only one element since there is only parameter.</li>
|
|
</ul>
|
|
</div>
|
|
<div class="section"><p>It is important to note that it is not necessary to define a procedure
|
|
in order to call it. However, if no procedure definition is found, either
|
|
from a prior CREATE PROCEDURE or from a DECLARE PROCEDURE in this program,
|
|
certain restrictions and assumptions are made when the procedure is called
|
|
on the CALL statement. For example, the NULL indicator argument cannot be
|
|
passed. </p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<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 class="relref"><strong>Related reference</strong><br />
|
|
<div><a href="rbafystatwo.htm" title="A static CALL statement without a corresponding CREATE PROCEDURE statement is processed with the following rules.">Use embedded CALL statement where no procedure definition exists</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |