<?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="creating, procedure, choosing parameter data types, locators, signature, specific name" /> <title>CREATE PROCEDURE</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="createp"></a> <h2 id="createp"><a href="rbafzmst02.htm#ToC_895">CREATE PROCEDURE</a></h2><a id="idx1912" name="idx1912"></a> <p></p> <p>The CREATE PROCEDURE statement defines a procedure at the current server.</p> <p>The following types of procedures can be defined:</p> <ul> <li>External <p>The procedure program or service program is written in a programming language such as C, COBOL, or Java™. The external executable is referenced by a procedure defined at the current server along with various attributes of the procedure. See <a href="rbafzmstcrtpef.htm#crtpef">CREATE PROCEDURE (External)</a>.</p></li> <li>SQL <p>The procedure is written exclusively in SQL. The procedure body is defined at the current server along with various attributes of the procedure. See <a href="rbafzmstcrtpsf.htm#crtpsf">CREATE PROCEDURE (SQL)</a>.</p></li></ul> <a name="wq1256"></a> <h3 id="wq1256"><a href="rbafzmst02.htm#ToC_896">Notes</a></h3> <p><span class="bold">Choosing data types for parameters:</span> <a id="idx1913" name="idx1913"></a>For portability of procedures across platforms that are not DB2 UDB for iSeries, do not use the following data types, which might have different representations on different platforms: </p> <ul> <li>FLOAT. Use DOUBLE or REAL instead.</li> <li>NUMERIC. Use DECIMAL instead.</li></ul> <p><span class="bold">Specifying AS LOCATOR for a parameter:</span> <a id="idx1914" name="idx1914"></a>Passing a locator instead of a value can result in fewer bytes being passed in or out of the procedure. This can be useful when the value of the parameter is very large. The AS LOCATOR clause specifies that a locator to the value of the parameter is passed instead of the actual value. Specify AS LOCATOR only for parameters with a LOB data type or a distinct type based on a LOB data type.</p> <p>AS LOCATOR cannot be specified for SQL procedures.</p> <p><span class="bold">Determining the uniqueness of procedures in a schema:</span> <a id="idx1915" name="idx1915"></a>At the current server, each procedure signature must be unique. The signature of a procedure is the qualified procedure name combined with the number of the parameters (the data types of the parameters are not part of a procedure's signature). This means that two different schemas can each contain a procedure with the same name that have the same number of parameters. However, a schema must not contain two procedures with the same name that have the same number of parameters.</p> <p><span class="bold">The specific name for a procedure:</span> <a id="idx1916" name="idx1916"></a>When defining multiple procedures with the same name and schema (with different number of parameters), it is recommended that a specific name also be specified. The specific name can be used to uniquely identify the procedure when dropping, granting to, revoking from, or commenting on the procedure.</p> <p>If the SPECIFIC clause is not specified, a specific name is generated.</p> <p><span class="bold">Special registers in procedures:</span> The settings of the special registers of the invoker are inherited by the procedure when called and restored upon return to the invoker.</p> <hr /><br /> [ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzmstxcindx.htm">Previous Page</a> | <a href="rbafzmstcrtpef.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>