692 lines
38 KiB
HTML
692 lines
38 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 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="ALTER PROCEDURE (External) statement,
|
|
ALTER PROCEDURE (External), SQL statements, PROCEDURE clause,
|
|
in ALTER PROCEDURE (External) statement, procedure-name,
|
|
in ALTER PROCEDURE (External), LANGUAGE clause, SQL clause, DB2GENERAL clause,
|
|
DB2SQL clause, GENERAL clause, GENERAL WITH NULLS clause, JAVA clause,
|
|
EXTERNAL NAME clause, DETERMINISTIC clause, NOT DETERMINISTIC clause,
|
|
MODIFIES SQL DATA clause, READS SQL DATA clause, CONTAINS SQL clause,
|
|
NO SQL clause, CALLED ON NULL INPUT clause, RESULT SETS clause, DBINFO clause,
|
|
NO DBINFO clause, FENCED clause, NOT FENCED clause, DEBUG MODE clause,
|
|
SAVEPOINT LEVEL clause, COMMIT ON RETURN clause" />
|
|
<title>ALTER PROCEDURE (External)</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="aproceduree"></a>
|
|
<h2 id="aproceduree"><a href="rbafzmst02.htm#ToC_741">ALTER PROCEDURE (External)</a></h2><a id="idx1277" name="idx1277"></a><a id="idx1278" name="idx1278"></a>
|
|
<p>The ALTER PROCEDURE (External) statement alters a procedure at the current
|
|
server.</p>
|
|
<a name="wq1035"></a>
|
|
<h3 id="wq1035"><a href="rbafzmst02.htm#ToC_742">Invocation</a></h3>
|
|
<p>This statement can be embedded in an application program or issued interactively.
|
|
It is an executable statement that can be dynamically prepared.</p>
|
|
<a name="wq1036"></a>
|
|
<h3 id="wq1036"><a href="rbafzmst02.htm#ToC_743">Authorization</a></h3>
|
|
<p>The privileges held by the authorization ID of the statement
|
|
must include at least one of the following:</p>
|
|
<ul>
|
|
<li>For the procedure identified in the statement:
|
|
<ul>
|
|
<li>The ALTER privilege for the procedure, and</li>
|
|
<li>The system authority *EXECUTE on the library containing the procedure.</li></ul></li>
|
|
<li>Administrative authority</li></ul>
|
|
<p>For information on the system authorities corresponding to SQL privileges,
|
|
see <a href="rbafzmstgntprc.htm#eqtabler">Corresponding System Authorities When Checking Privileges to a Function or Procedure</a>, <a href="rbafzmstgnt.htm#eqtablet">Corresponding System Authorities When Checking Privileges to a Table or View</a>, and <a href="rbafzmstgntudtp.htm#eqtabled">Corresponding System Authorities When Checking Privileges to a Distinct Type</a>.</p>
|
|
<a name="wq1037"></a>
|
|
<h3 id="wq1037"><a href="rbafzmst02.htm#ToC_744">Syntax</a></h3>
|
|
<a href="rbafzmstaproceduree.htm#synaeprocedure"><img src="c.gif" alt="Click to skip syntax diagram" /></a>
|
|
<pre class="cgraphic"><span><img src="c.gif" alt="Read syntax diagram" longdesc="rbafzmstsyn241.htm"
|
|
border="0" /></span><a href="#skipsyn-240"><img src="c.gif" alt="Skip visual syntax diagram"
|
|
border="0" /></a>>>-ALTER-------------------------------------------------------->
|
|
|
|
>--+-PROCEDURE--<span class="italic">procedure-name</span>--+--------------------------+-+-->
|
|
| '-(--+----------------+--)-' |
|
|
| '-<span class="italic">parameter-type</span>-' |
|
|
'-SPECIFIC PROCEDURE--<span class="italic">specific-name</span>-----------------------'
|
|
|
|
.-ALTER-.
|
|
>--+-------+--<span class="italic">option-list</span>--------------------------------------><
|
|
|
|
parameter-type:
|
|
|
|
|----<span class="italic">data-type</span>--+------------+----------------------------------|
|
|
'-AS LOCATOR-'
|
|
|
|
data-type:
|
|
|
|
|--+-<span class="italic">built-in-type</span>------+---------------------------------------|
|
|
'-<span class="italic">distinct-type-name</span>-'
|
|
|
|
</pre>
|
|
<a name="skipsyn-240" id="skipsyn-240"></a>
|
|
<a name="wq1038"></a>
|
|
<div class="fignone" id="wq1038">
|
|
<pre class="cgraphic"><span><img src="c.gif" alt="Read syntax diagram" longdesc="rbafzmstsyn242.htm"
|
|
border="0" /></span><a href="#skipsyn-241"><img src="c.gif" alt="Skip visual syntax diagram"
|
|
border="0" /></a>option-list:
|
|
|
|
|--+-----------------------+------------------------------------>
|
|
'-LANGUAGE--+-C-------+-'
|
|
+-C++-----+
|
|
+-CL------+
|
|
+-COBOL---+
|
|
+-COBOLLE-+
|
|
+-FORTRAN-+
|
|
+-JAVA----+
|
|
+-PLI-----+
|
|
+-REXX----+
|
|
+-RPG-----+
|
|
'-RPGLE---'
|
|
|
|
>--+----------------------------------------+------------------->
|
|
'-+-PARAMETER STYLE SQL----------------+-'
|
|
+-PARAMETER STYLE DB2SQL-------------+
|
|
+-PARAMETER STYLE GENERAL------------+
|
|
+-PARAMETER STYLE GENERAL WITH NULLS-+
|
|
+-PARAMETER STYLE JAVA---------------+
|
|
'-PARAMETER STYLE DB2GENERAL---------'
|
|
|
|
(1)
|
|
>--+-------------------+-------+-------------------+------------>
|
|
+-NOT DETERMINISTIC-+ +-MODIFIES SQL DATA-+
|
|
'-DETERMINISTIC-----' +-READS SQL DATA----+
|
|
+-CONTAINS SQL------+
|
|
'-NO SQL------------'
|
|
|
|
.-CALLED ON NULL INPUT-.
|
|
>--+----------------------+--+------------------------------+--->
|
|
'-DYNAMIC RESULT SETS--<span class="italic">integer</span>-'
|
|
|
|
>--+-----------+--+---------------------+--+------------+------->
|
|
+-NO DBINFO-+ +-ALLOW DEBUG MODE----+ +-FENCED-----+
|
|
'-DBINFO----' +-DISABLE DEBUG MODE--+ '-NOT FENCED-'
|
|
'-DISALLOW DEBUG MODE-'
|
|
|
|
>--+--------------------------------------+--------------------->
|
|
'-EXTERNAL NAME--<span class="italic">external-program-name</span>-'
|
|
|
|
>--+---------------------+--+----------------------+------------|
|
|
+-OLD SAVEPOINT LEVEL-+ +-<span>COMMIT ON RETURN NO</span>--+
|
|
'-NEW SAVEPOINT LEVEL-' '-<span>COMMIT ON RETURN YES</span>-'
|
|
|
|
</pre>
|
|
<a name="skipsyn-241" id="skipsyn-241"></a>
|
|
<a name="wq1039"></a>
|
|
<div class="notelisttitle" id="wq1039">Notes:</div>
|
|
<ol type="1">
|
|
<li>The clauses in the <var class="pv">option-list</var> can be specified
|
|
in any order.</li>
|
|
</ol></div>
|
|
<a name="wq1041"></a>
|
|
<div class="fignone" id="wq1041">
|
|
<pre class="cgraphic"><span><img src="c.gif" alt="Read syntax diagram" longdesc="rbafzmstsyn243.htm"
|
|
border="0" /></span><a href="#skipsyn-242"><img src="c.gif" alt="Skip visual syntax diagram"
|
|
border="0" /></a>built-in-type:
|
|
|
|
|--+-+---SMALLINT---+--------------------------------------------------------------------------+--|
|
|
| +-+-INTEGER-+--+ |
|
|
| | '-INT-----' | |
|
|
| '---BIGINT-----' |
|
|
| .-(5,0)------------------------. |
|
|
+-+-+-DECIMAL-+-+--+------------------------------+-----------------------------------------+
|
|
| | '-DEC-----' | | .-,0--------. | |
|
|
| '-NUMERIC-----' '-(--<span class="italic">integer</span>--+-----------+--)-' |
|
|
| '-<span class="italic">, integer</span>-' |
|
|
| .-(--53--)------. |
|
|
+-+-FLOAT--+---------------+-+--------------------------------------------------------------+
|
|
| | '-(--<span class="italic">integer</span>--)-' | |
|
|
| +-REAL---------------------+ |
|
|
| | .-PRECISION-. | |
|
|
| '-DOUBLE--+-----------+----' |
|
|
| .-(--1--)-------. |
|
|
+-+-+-+-CHARACTER-+--+---------------+----------+--+----------------+---------------------+-+
|
|
| | | '-CHAR------' '-(--<span class="italic">integer</span>--)-' | +-FOR BIT DATA---+ | |
|
|
| | '-+-+-CHARACTER-+--VARYING-+--(--<span class="italic">integer</span>--)-' +-FOR SBCS DATA--+ | |
|
|
| | | '-CHAR------' | +-FOR MIXED DATA-+ | |
|
|
| | '-VARCHAR----------------' '-<span class="italic">ccsid-clause</span>---' | |
|
|
| | .-(--1M--)-------------. | |
|
|
| '-----+-+-<span>CHARACTER</span>-+--<span>LARGE OBJECT</span>-+------+----------------------+--+----------------+-' |
|
|
| | '-<span>CHAR</span>------' | '-(--<span class="italic">integer</span>--+---+--)-' +-FOR SBCS DATA--+ |
|
|
| '-<span>CLOB</span>------------------------' +-K-+ +-FOR MIXED DATA-+ |
|
|
| +-M-+ '-<span class="italic">ccsid-clause</span>---' |
|
|
| '-G-' |
|
|
| .-(--1--)-------. |
|
|
+-+---GRAPHIC----+---------------+-------+--+--------------+--------------------------------+
|
|
| | '-(--<span class="italic">integer</span>--)-' | '-<span class="italic">ccsid-clause</span>-' |
|
|
| +-+-GRAPHIC VARYING-+--(--<span class="italic">integer</span>--)---+ |
|
|
| | '-VARGRAPHIC------' | |
|
|
| | .-(--1M--)-------------. | |
|
|
| '---DBCLOB----+----------------------+-' |
|
|
| '-(--<span class="italic">integer</span>--+---+--)-' |
|
|
| +-K-+ |
|
|
| +-M-+ |
|
|
| '-G-' |
|
|
| .-(--1--)-------. |
|
|
+-+-+-BINARY--+---------------+---------+-----------------+---------------------------------+
|
|
| | | '-(--<span class="italic">integer</span>--)-' | | |
|
|
| | '-+-BINARY VARYING-+--(--<span class="italic">integer</span>--)-' | |
|
|
| | '-VARBINARY------' | |
|
|
| | .-(--1M--)-------------. | |
|
|
| '---+-BLOB----------------+----+----------------------+-' |
|
|
| '-BINARY LARGE OBJECT-' '-(--<span class="italic">integer</span>--+---+--)-' |
|
|
| +-K-+ |
|
|
| +-M-+ |
|
|
| '-G-' |
|
|
+-+-DATE-------------------+----------------------------------------------------------------+
|
|
| | .-(--0--)-. | |
|
|
| +-TIME--+---------+------+ |
|
|
| | .-(--6--)-. | |
|
|
| '-TIMESTAMP--+---------+-' |
|
|
| .-(--200--)-----. |
|
|
+---DATALINK--+---------------+--+--------------+-------------------------------------------+
|
|
| '-(--<span class="italic">integer</span>--)-' '-<span class="italic">ccsid-clause</span>-' |
|
|
'---ROWID-----------------------------------------------------------------------------------'
|
|
|
|
ccsid-clause:
|
|
|
|
.-NOT NORMALIZED-.
|
|
|--CCSID--<span class="italic">integer</span>--+----------------+---------------------------|
|
|
'-NORMALIZED-----'
|
|
|
|
</pre>
|
|
<a name="skipsyn-242" id="skipsyn-242"></a></div>
|
|
<a name="synaeprocedure"></a>
|
|
<h3 id="synaeprocedure"><a href="rbafzmst02.htm#ToC_745">Description</a></h3>
|
|
<p></p>
|
|
<dl class="parml">
|
|
<dt class="bold">PROCEDURE or SPECIFIC PROCEDURE</dt><a id="idx1279" name="idx1279"></a><a id="idx1280" name="idx1280"></a>
|
|
<dd>Identifies the procedure to alter. <span class="italic">procedure-name</span> must identify a procedure that exists at the current server.
|
|
<p>The
|
|
specified procedure is altered. The owner of the procedure is preserved. If
|
|
the external program or service program exists at the time the procedure is
|
|
altered, all privileges on the procedure are preserved.</p>
|
|
<dl class="parml">
|
|
<dt class="bold">PROCEDURE <var class="pv">procedure-name</var></dt>
|
|
<dd> Identifies the procedure by its name. The <var class="pv">procedure-name</var> must
|
|
identify exactly one procedure. The procedure may have any number of parameters
|
|
defined for it. If there is more than one procedure of the specified name
|
|
in the specified or implicit schema, an error is returned.
|
|
</dd>
|
|
<dt class="bold">PROCEDURE <var class="pv">procedure-name (parameter-type,...)</var></dt>
|
|
<dd>Identifies the procedure by its procedure signature, which
|
|
uniquely identifies the procedure. The <var class="pv">procedure-name (parameter-type,...)</var> must identify a procedure with the specified procedure signature. The
|
|
specified parameters must match the data types in the corresponding position
|
|
that were specified when the procedure was created. The number of data types
|
|
and the logical concatenation of the data types is used to identify the specific
|
|
procedure instance which is being altered. Synonyms for data types are considered
|
|
a match.
|
|
<p>If <var class="pv">procedure-name()</var> is specified, the procedure identified
|
|
must have zero parameters.</p>
|
|
<dl class="parml">
|
|
<dt class="bold"><var class="pv">procedure-name</var></dt>
|
|
<dd>Identifies the name of the procedure.
|
|
</dd>
|
|
<dt class="bold"><var class="pv">(parameter-type,...)</var></dt>
|
|
<dd>Identifies the parameters of the procedure.
|
|
<p>If an unqualified distinct
|
|
type name is specified, the database manager searches the SQL path to resolve
|
|
the schema name for the distinct type.</p>
|
|
<p>For data types that have a length,
|
|
precision, or scale attribute, use one of the following:</p>
|
|
<ul>
|
|
<li>Empty parenthesis indicates that the database manager ignores the attribute
|
|
when determining whether the data types match. For example, DEC() will be
|
|
considered a match for a parameter of a procedure defined with a data type
|
|
of DEC(7,2). However, FLOAT cannot be specified with empty parenthesis because
|
|
its precision value indicates a specific data type (REAL or DOUBLE).</li>
|
|
<li>If a specific value for a length, precision, or scale attribute is specified,
|
|
the value must exactly match the value that was specified (implicitly or explicitly)
|
|
in the CREATE PROCEDURE statement. If the data type is FLOAT, the precision
|
|
does not have to exactly match the value that was specified because matching
|
|
is based on the data type (REAL or DOUBLE).</li>
|
|
<li>If length, precision, or scale is not explicitly specified, and empty
|
|
parentheses are not specified, the default attributes of the data type are
|
|
implied. The implicit length must exactly match the value that was specified
|
|
(implicitly or explicitly) in the CREATE PROCEDURE statement.</li></ul>
|
|
<p>Specifying the FOR DATA clause or CCSID clause is optional. Omission
|
|
of either clause indicates that the database manager ignores the attribute when determining
|
|
whether the data types match. If either clause is specified, it must match
|
|
the value that was implicitly or explicitly specified in the CREATE PROCEDURE
|
|
statement.</p>
|
|
</dd>
|
|
<dt class="bold">AS LOCATOR</dt>
|
|
<dd>Specifies that the procedure is defined to receive a locator for this
|
|
parameter. If AS LOCATOR is specified, the data type must be a LOB or a distinct
|
|
type based on a LOB.
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
<dt class="bold">SPECIFIC PROCEDURE <var class="pv">specific-name</var></dt>
|
|
<dd>Identifies the procedure by its specific name. The <var class="pv">specific-name</var> must identify a specific procedure that exists at the current server.
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
<dt class="bold">ALTER <var class="pv">option-list</var></dt>
|
|
<dd>Indicates that one or more of the options of the procedure are to be
|
|
altered. If an option is not specified, the value from the existing procedure
|
|
definition is used.
|
|
<dl class="parml">
|
|
<dt class="bold">LANGUAGE </dt><a id="idx1281" name="idx1281"></a>
|
|
<dd>Specifies the language that the external program or service program
|
|
is written in. The language clause is required if the external program is
|
|
a REXX procedure.
|
|
<dl class="parml">
|
|
<dt class="bold">C</dt>
|
|
<dd>The external program is written in C.
|
|
</dd>
|
|
<dt class="bold">C++ </dt>
|
|
<dd>The external program is written in C++.
|
|
</dd>
|
|
<dt class="bold">CL</dt>
|
|
<dd>The external program is written in CL.
|
|
</dd>
|
|
<dt class="bold">COBOL</dt>
|
|
<dd>The external program is written in COBOL.
|
|
</dd>
|
|
<dt class="bold">COBOLLE</dt>
|
|
<dd>The external program is written in ILE COBOL.
|
|
</dd>
|
|
<dt class="bold">FORTRAN</dt>
|
|
<dd>The external program is written in FORTRAN.
|
|
</dd>
|
|
<dt class="bold">JAVA</dt>
|
|
<dd>The external program is written in JAVA.
|
|
</dd>
|
|
<dt class="bold">PLI</dt>
|
|
<dd>The external program is written in PL/I.
|
|
</dd>
|
|
<dt class="bold">REXX</dt>
|
|
<dd>The external program is a REXX procedure.
|
|
</dd>
|
|
<dt class="bold">RPG</dt>
|
|
<dd>The external program is written in RPG.
|
|
</dd>
|
|
<dt class="bold">RPGLE</dt>
|
|
<dd>The external program is written in ILE RPG.
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
<dt class="bold">PARAMETER STYLE</dt>
|
|
<dd>Specifies the conventions used for passing parameters to and returning
|
|
the values from procedures:
|
|
<dl class="parml"><a id="idx1282" name="idx1282"></a>
|
|
<dt class="bold">SQL</dt>
|
|
<dd>Specifies that in addition to the parameters on the CALL statement,
|
|
several additional parameters are passed to the procedure. The parameters
|
|
are defined to be in the following order:
|
|
<ul>
|
|
<li>The first N parameters are the parameters that are specified on the CREATE
|
|
PROCEDURE statement.</li>
|
|
<li>N parameters for indicator variables for the parameters.</li>
|
|
<li>A CHAR(5) output parameter for SQLSTATE. The SQLSTATE returned indicates
|
|
the success or failure of the procedure. The SQLSTATE returned is assigned
|
|
by the external program.
|
|
<p>The user may set the SQLSTATE to any valid value
|
|
in the external program to return an error or warning from the procedure.</p></li>
|
|
<li>A VARCHAR(517) input parameter for the fully qualified procedure name.</li>
|
|
<li>A VARCHAR(128) input parameter for the specific name.</li>
|
|
<li>A VARCHAR(70) output parameter for the message text.</li></ul>For more information about the parameters passed, see the include <span>sqludf</span> in the appropriate source file in library QSYSINC.
|
|
For example, for C, sqludf can be found in QSYSINC/H.
|
|
<p>PARAMETER STYLE SQL
|
|
cannot be used with LANGUAGE JAVA.</p>
|
|
</dd>
|
|
<dt class="bold">DB2GENERAL </dt><a id="idx1283" name="idx1283"></a>
|
|
<dd>Specifies that the procedure will use a parameter passing convention
|
|
that is defined for use with Java™ methods.
|
|
<p>PARAMETER STYLE DB2GENERAL
|
|
can only be specified with LANGUAGE JAVA. For details on passing parameters
|
|
in JAVA, see the <a href="../rzaha/whatitis.htm">IBM® Developer Kit for Java</a>.</p>
|
|
</dd>
|
|
<dt class="bold">DB2SQL</dt><a id="idx1284" name="idx1284"></a>
|
|
<dd>Specifies that in addition to the parameters on the CALL statement,
|
|
several additional parameters are passed to the procedure. DB2SQL is identical
|
|
to the SQL parameter style, except that the following additional parameter
|
|
may be passed as the last parameter:
|
|
<ul>
|
|
<li>A parameter for the dbinfo structure, if DBINFO was specified on the CREATE
|
|
PROCEDURE statement.</li></ul>For more information about the parameters passed, see the include <span>sqludf</span> in the appropriate source file in library QSYSINC.
|
|
For example, for C, sqludf can be found in QSYSINC/H.
|
|
<p>PARAMETER STYLE DB2SQL
|
|
cannot be used with LANGUAGE JAVA.</p>
|
|
</dd>
|
|
<dt class="bold">GENERAL </dt><a id="idx1285" name="idx1285"></a>
|
|
<dd>Specifies that the procedure will use a parameter passing mechanism
|
|
where the procedure receives the parameters specified on the CALL. Additional
|
|
arguments are not passed for indicator variables.
|
|
<p>PARAMETER STYLE GENERAL
|
|
cannot be used with LANGUAGE JAVA.</p>
|
|
</dd>
|
|
<dt class="bold">GENERAL WITH NULLS </dt><a id="idx1286" name="idx1286"></a>
|
|
<dd>Specifies that in addition to the parameters on the CALL statement as
|
|
specified in GENERAL, another argument is passed to the procedure. This additional
|
|
argument contains an indicator array with an element for each of the parameters
|
|
of the CALL statement. In C, this would be an array of short INTs. For more
|
|
information about how the indicators are handled, see the <a href="../sqlp/rbafykickoff.htm">SQL Programming</a> book.
|
|
<p>PARAMETER STYLE GENERAL WITH NULLS cannot be used
|
|
with LANGUAGE JAVA.</p>
|
|
</dd>
|
|
<dt class="bold">JAVA </dt><a id="idx1287" name="idx1287"></a>
|
|
<dd>Specifies that the procedure will use a parameter passing
|
|
convention that conforms to the Java language and ISO/IEC FCD 9075-13:2003, <span class="italic">Information technology - Database languages - SQL - Part 13: Java Routines and Types (SQL/JRT)</span> specification. INOUT and OUT
|
|
parameters will be passed as single entry arrays to facilitate returning values.
|
|
|
|
<p>PARAMETER STYLE JAVA can only be specified with LANGUAGE JAVA. For increased
|
|
portability, you should write Java procedures that use the PARAMETER
|
|
STYLE JAVA conventions. For details on passing parameters in JAVA, see the <a href="../rzaha/whatitis.htm">IBM Developer Kit for Java</a> book.</p>
|
|
</dd>
|
|
</dl>
|
|
<p>Note that the language of the external procedure determines how
|
|
the parameters are passed. For example, in C, any VARCHAR or CHAR parameters
|
|
are passed as NUL-terminated strings. For more information, see the <a href="../sqlp/rbafykickoff.htm">SQL Programming</a> book. For Java routines, see the <a href="../rzaha/whatitis.htm">IBM Developer
|
|
Kit for Java</a>.</p>
|
|
</dd>
|
|
<dt class="bold">EXTERNAL NAME <var class="pv">external-program-name</var> </dt><a id="idx1288" name="idx1288"></a>
|
|
<dd>Specifies the program or service program that will be executed when
|
|
the procedure is called by the CALL statement. The program name must identify
|
|
a program or service program that exists at the application server at the time the
|
|
procedure is called. If the naming option is *SYS and the name is not qualified:
|
|
<ul>
|
|
<li>The current path will be used to search for the program or service program
|
|
at the time the procedure is called.</li>
|
|
<li>*LIBL will be used to search for the program or service program at the
|
|
time grants or revokes are performed on the procedure.</li></ul>
|
|
<p>The validity of the name is checked at the application server. If the format
|
|
of the name is not correct, an error is returned.</p>
|
|
<p>The external program
|
|
or service program need not exist at the time the procedure is altered, but
|
|
it must exist at the time the procedure is called.</p>
|
|
<p>CONNECT, SET CONNECTION,
|
|
RELEASE, DISCONNECT, and SET TRANSACTION statements are not allowed in a procedure
|
|
that is running on a remote application server. COMMIT and ROLLBACK statements are
|
|
not allowed in an ATOMIC SQL procedure or in a procedure that is running on
|
|
a connection to a remote application server.</p>
|
|
</dd>
|
|
<dt class="bold">NOT DETERMINISTIC <span class="base">or</span> DETERMINISTIC</dt><a id="idx1289" name="idx1289"></a><a id="idx1290" name="idx1290"></a>
|
|
<dd>Specifies whether the procedure returns the same results each time the
|
|
procedure is called with the same IN and INOUT arguments.
|
|
<dl class="parml">
|
|
<dt class="bold">NOT DETERMINISTIC</dt>
|
|
<dd>The procedure may not return the same result each time the procedure
|
|
is called with the same IN and INOUT arguments, even when the referenced data
|
|
in the database has not changed.
|
|
</dd>
|
|
<dt class="bold">DETERMINISTIC</dt>
|
|
<dd>The procedure always returns the same results each time the procedure
|
|
is called with the same IN and INOUT arguments, provided the referenced data
|
|
in the database has not changed.
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
<dt class="bold">MODIFIES SQL DATA, READS SQL DATA, CONTAINS SQL, <span class="base">or</span> NO SQL</dt>
|
|
<dd><span>Specifies the classification of SQL statements that this procedure,
|
|
or any routine called by this procedure, can execute. The database manager
|
|
verifies that the SQL statements issued by the procedure and all routines
|
|
called by the procedure are consistent with this specification. For the classification
|
|
of each statement, see <a href="rbafzmstaccind.htm#accind">SQL statement data access indication in routines</a>.</span>
|
|
<dl class="parml">
|
|
<dt class="bold">MODIFIES SQL DATA </dt><a id="idx1291" name="idx1291"></a>
|
|
<dd>Specifies that the procedure can execute any SQL statement except statements
|
|
that are not supported in procedures.
|
|
</dd>
|
|
<dt class="bold">READS SQL DATA</dt><a id="idx1292" name="idx1292"></a>
|
|
<dd>Specifies that the procedure can execute statements with a data access
|
|
classification of READS SQL DATA or CONTAINS SQL.
|
|
</dd>
|
|
<dt class="bold">CONTAINS SQL</dt><a id="idx1293" name="idx1293"></a>
|
|
<dd>Specifies that the procedure can only execute statements with a data
|
|
access classification of CONTAINS SQL.
|
|
</dd>
|
|
<dt class="bold">NO SQL</dt><a id="idx1294" name="idx1294"></a>
|
|
<dd>The function does not execute SQL statements.
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
<dt class="bold">CALLED ON NULL INPUT</dt><a id="idx1295" name="idx1295"></a>
|
|
<dd>Specifies that the procedure will be called if any, or all, parameter
|
|
values are null.
|
|
</dd>
|
|
<dt class="bold">DYNAMIC RESULT SETS <var class="pv">integer</var></dt><a id="idx1296" name="idx1296"></a>
|
|
<dd>Specifies the maximum number of result sets that can be returned
|
|
from the procedure. <var class="pv">integer</var> must be greater than or equal to zero
|
|
and less than 32768. If zero is specified, no result sets are returned. If
|
|
the SET RESULT SETS statement is issued, the number of result sets returned
|
|
is the minimum of the number of results sets specified on this keyword and
|
|
the SET RESULT SETS statement. If the SET RESULT SETS statement specifies
|
|
a number larger than the maximum number of result sets, a warning is returned.
|
|
Note that any result sets from cursors that have a RETURN TO CLIENT attribute
|
|
are included in the number of result sets of the outermost procedure.
|
|
<p>The result sets are scrollable if a cursor is used to return a result set
|
|
and the cursor is scrollable. If a cursor is used to return a result set,
|
|
the result set starts with the current position. Thus, if 5 FETCH NEXT operations
|
|
have been performed prior to returning from the procedure, the result set
|
|
will start with the 6th row of the result set.</p>
|
|
<p>Result sets are only
|
|
returned if both the following are true: </p>
|
|
<ul>
|
|
<li>the procedure is directly called or if the procedure is a RETURN
|
|
TO CLIENT procedure and is indirectly called from ODBC, JDBC, OLE DB, .NET,
|
|
the SQL Call Level Interface, or the iSeries Access Family Optimized SQL API, and</li>
|
|
<li>the external program does not have an attribute of ACTGRP(*NEW).</li></ul><p class="indatacontent">For more information about result sets see <a href="rbafzmsthsetrs.htm#hsetrs">SET RESULT SETS</a>.</p>
|
|
</dd>
|
|
<dt class="bold">DBINFO</dt><a id="idx1297" name="idx1297"></a><a id="idx1298" name="idx1298"></a>
|
|
<dd>Specifies whether or not the procedure requires the database information
|
|
be passed.
|
|
<dl class="parml">
|
|
<dt class="bold">DBINFO</dt>
|
|
<dd>Specifies that the database manager should pass a structure containing
|
|
status information to the procedure. <a href="rbafzmstaproceduree.htm#dbinfotb2">Table 45</a> contains a description
|
|
of the DBINFO structure. Detailed information about the DBINFO structure can
|
|
be found in include <span>sqludf</span> in the appropriate source
|
|
file in library QSYSINC. For example, for C, sqludf can be found in QSYSINC/H.
|
|
<p>DBINFO is only allowed with PARAMETER STYLE DB2SQL.</p>
|
|
<a name="dbinfotb2"></a>
|
|
<table id="dbinfotb2" width="100%" summary="" border="1" frame="border" rules="all">
|
|
<caption>Table 45. DBINFO fields</caption>
|
|
<thead valign="bottom">
|
|
<tr>
|
|
<th id="wq1042" width="21%" align="left" valign="bottom">Field</th>
|
|
<th id="wq1043" width="15%" align="left" valign="bottom">Data Type</th>
|
|
<th id="wq1044" width="62%" align="left" valign="bottom">Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody valign="top">
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq1042">Relational database</td>
|
|
<td align="left" valign="top" headers="wq1043">VARCHAR(128)</td>
|
|
<td align="left" valign="top" headers="wq1044">The name of the current server.</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq1042">Authorization ID</td>
|
|
<td align="left" valign="top" headers="wq1043">VARCHAR(128)</td>
|
|
<td align="left" valign="top" headers="wq1044">The run-time authorization ID.</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq1042">CCSID Information</td>
|
|
<td align="left" valign="top" headers="wq1043">
|
|
<div class="lines">INTEGER<br />
|
|
INTEGER<br />
|
|
INTEGER<br />
|
|
</div>
|
|
<div class="lines"> <br />
|
|
</div>
|
|
<div class="lines">INTEGER<br />
|
|
INTEGER<br />
|
|
INTEGER<br />
|
|
</div>
|
|
<div class="lines"> <br />
|
|
</div>
|
|
<div class="lines">INTEGER<br />
|
|
INTEGER<br />
|
|
INTEGER<br />
|
|
</div>
|
|
<div class="lines"> <br />
|
|
</div>
|
|
<div class="lines">INTEGER<br />
|
|
</div>
|
|
<div class="lines"> <br />
|
|
</div>
|
|
<div class="lines">CHAR(8)<br />
|
|
</div></td>
|
|
<td align="left" valign="top" headers="wq1044">The CCSID information of the job. Three sets
|
|
of three CCSIDs are returned. The following information identifies the three
|
|
CCSIDs in each set:
|
|
<ul>
|
|
<li>SBCS CCSID</li>
|
|
<li>DBCS CCSID</li>
|
|
<li>Mixed CCSID</li></ul>Following the three sets of CCSIDs is an integer that indicates which
|
|
set of three sets of CCSIDs is applicable and eight bytes of reserved space.
|
|
<p>If a CCSID is not explicitly specified for a parameter on the CREATE PROCEDURE
|
|
statement, the input string is assumed to be encoded in the CCSID of the job
|
|
at the time the procedure is executed. If the CCSID of the input string is
|
|
not the same as the CCSID of the parameter, the input string passed to the
|
|
external procedure will be converted before calling the external program.</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq1042">Target Column</td>
|
|
<td align="left" valign="top" headers="wq1043">VARCHAR(128)
|
|
<div class="lines">VARCHAR(128)<br />
|
|
</div>
|
|
<div class="lines">VARCHAR(128)<br />
|
|
</div></td>
|
|
<td align="left" valign="top" headers="wq1044">Not applicable for a call to a procedure.</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq1042">Version and release</td>
|
|
<td align="left" valign="top" headers="wq1043">CHAR(8)</td>
|
|
<td align="left" valign="top" headers="wq1044">The version, release, and modification level
|
|
of the database manager.</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" headers="wq1042">Platform</td>
|
|
<td align="left" valign="top" headers="wq1043">INTEGER</td>
|
|
<td align="left" valign="top" headers="wq1044">The server's platform type.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</dd>
|
|
<dt class="bold">NO DBINFO</dt>
|
|
<dd>Specifies that the procedure does not require the database information
|
|
to be passed.
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
<dt class="bold">FENCED <span class="base">or</span> NOT FENCED</dt><a id="idx1299" name="idx1299"></a><a id="idx1300" name="idx1300"></a>
|
|
<dd>This parameter is allowed for compatibility with other products and
|
|
is not used by DB2 UDB for iSeries.
|
|
</dd>
|
|
<dt class="bold">DISALLOW DEBUG MODE, ALLOW DEBUG MODE, <span class="base">or</span> DISABLE
|
|
DEBUG MODE</dt><a id="idx1301" name="idx1301"></a>
|
|
<dd><span>Indicates whether the procedure can be debugged by the Unified Debugger.</span> If DEBUG MODE is not specified, the procedure will be created with
|
|
the debug mode specified by the CURRENT DEBUG MODE special register.
|
|
<p>DEBUG
|
|
MODE can only be specified with LANGUAGE JAVA procedures.</p>
|
|
<dl class="parml">
|
|
<dt class="bold">DISALLOW DEBUG MODE</dt>
|
|
<dd>The procedure cannot be debugged by the Unified Debugger. When the DEBUG MODE
|
|
attribute of the procedure is DISALLOW, the procedure can be subsequently
|
|
altered to change the debug mode attribute.
|
|
</dd>
|
|
<dt class="bold">ALLOW DEBUG MODE</dt>
|
|
<dd>The procedure can be debugged by the Unified Debugger. When the DEBUG MODE
|
|
attribute of the procedure is ALLOW, the procedure can be subsequently altered
|
|
to change the debug mode attribute.
|
|
</dd>
|
|
<dt class="bold">DISABLE DEBUG MODE</dt>
|
|
<dd>The procedure cannot be debugged by the Unified Debugger. When the DEBUG MODE
|
|
attribute of the procedure is DISABLE, the procedure cannot be subsequently
|
|
altered to change the debug mode attribute.
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
<dt class="bold">OLD SAVEPOINT LEVEL <span class="base">or</span> NEW SAVEPOINT LEVEL</dt><a id="idx1302" name="idx1302"></a>
|
|
<dd>Specifies whether a new savepoint level is to be created on entry to
|
|
the procedure.
|
|
<dl class="parml">
|
|
<dt class="bold">OLD SAVEPOINT LEVEL</dt>
|
|
<dd>A new savepoint level is not created. Any SAVEPOINT statements issued
|
|
within the procedure with OLD SAVEPOINT LEVEL implicitly or explicitly specified
|
|
on the SAVEPOINT statement are created at the same savepoint level as the
|
|
caller of the procedure.
|
|
</dd>
|
|
<dt class="bold">NEW SAVEPOINT LEVEL</dt>
|
|
<dd>A new savepoint level is created on entry to the procedure. Any savepoints
|
|
set within the procedure are created at a savepoint level that is nested deeper
|
|
than the level at which this procedure was invoked. Therefore, the name of
|
|
any new savepoint within the procedure will not conflict with any existing
|
|
savepoint levels (such as the savepoint level of the calling program) with
|
|
the same name.
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
<dt class="bold">COMMIT ON RETURN</dt><a id="idx1303" name="idx1303"></a>
|
|
<dd>Specifies whether the database manager commits the transaction immediately
|
|
on return from the procedure.
|
|
<dl class="parml">
|
|
<dt class="bold">NO</dt>
|
|
<dd>The database manager does not issue a commit when the procedure returns.
|
|
</dd>
|
|
<dt class="bold">YES</dt>
|
|
<dd>The database manager issues a commit when the procedure returns successfully.
|
|
If the procedure returns with an error, a commit is not issued.
|
|
<p>The commit
|
|
operation includes the work that is performed by the calling application process
|
|
and the procedure.</p>
|
|
<p>If the procedure returns result sets, the cursors
|
|
that are associated with must have been defined as WITH HOLD to be usable
|
|
after the commit.</p>
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
</dl>
|
|
<a name="wq1045"></a>
|
|
<h3 id="wq1045"><a href="rbafzmst02.htm#ToC_746">Notes</a></h3>
|
|
<p><span class="bold">General considerations for defining or replacing procedures:</span> See CREATE PROCEDURE for general information on defining a procedure.
|
|
ALTER PROCEDURE (External) allows individual attributes to be altered while
|
|
preserving the privileges on the procedure.</p>
|
|
<p><span class="bold">Syntax alternatives:</span> The following keywords are synonyms
|
|
supported for compatibility to prior releases. These keywords are non-standard
|
|
and should not be used:</p>
|
|
<ul>
|
|
<li>The keywords VARIANT and NOT VARIANT can be used as synonyms for NOT DETERMINISTIC
|
|
and DETERMINISTIC.</li>
|
|
<li>The keywords NULL CALL can be used as synonyms for CALLED ON
|
|
NULL INPUT.</li>
|
|
<li>DYNAMIC RESULT SET, RESULT SETS, and RESULT SET may be used as synonyms
|
|
for DYNAMIC RESULT SETS.</li></ul>
|
|
<a name="wq1046"></a>
|
|
<h3 id="wq1046"><a href="rbafzmst02.htm#ToC_747">Examples</a></h3>
|
|
<p>Modify the definition for an external procedure so that SQL changes are
|
|
committed on return from the procedure.</p>
|
|
<pre class="xmp"> <span class="bold">ALTER PROCEDURE</span> UPDATE_SALARY_1
|
|
<span class="bold">ALTER COMMIT ON RETURN YES</span></pre>
|
|
<hr /><br />
|
|
[ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzallocatedescr.htm">Previous Page</a> | <a href="rbafzmstaprocedures.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>
|