ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzajp_5.4.0.1/rzajpembedsqlrexx.htm

183 lines
9.0 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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="Embed SQL statements in REXX applications" />
<meta name="abstract" content="An SQL statement can be placed anywhere a REXX command can be placed." />
<meta name="description" content="An SQL statement can be placed anywhere a REXX command can be placed." />
<meta name="DC.subject" content="EXECSQL REXX command, coding examples, SQL statements in, REXX applications" />
<meta name="keywords" content="EXECSQL REXX command, coding examples, SQL statements in, REXX applications" />
<meta name="DC.Relation" scheme="URI" content="rzajprexx.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpcommentsrexx.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpcontinuationrexx.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpincludecoderexx.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpmarginsrexx.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpnamesrexx.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpnullsrexx.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpstmtlabelsrexx.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajprxerr.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="rzajpembedsqlrexx" />
<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>Embed SQL statements in REXX applications</title>
</head>
<body id="rzajpembedsqlrexx"><a name="rzajpembedsqlrexx"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Embed SQL statements in REXX applications</h1>
<div><p>An SQL statement can be placed anywhere a REXX command can be placed.</p>
<div class="section"><p>Each SQL statement in a REXX procedure must begin with EXECSQL
(in any combination of uppercase and lowercase letters), followed by either:</p>
<ul><li>The SQL statement enclosed in single or double quotation marks, or</li>
<li>A REXX variable containing the statement. Note that a colon must not precede
a REXX variable when it contains an SQL statement.</li>
</ul>
</div>
<div class="section"><p>For example:</p>
<pre>EXECSQL “COMMIT”</pre>
<p> is
equivalent to:</p>
<pre>rexxvar = “COMMIT”
EXECSQL rexxvar</pre>
</div>
<div class="section"><p>The command follows normal REXX rules. For example, it can optionally
be followed by a semicolon (;) to allow a single line to contain more than
one REXX statement. REXX also permits command names to be included within
single quotation marks, for example:</p>
<pre>'EXECSQL COMMIT'</pre>
</div>
<div class="section"><p>The SQL/REXX interface supports the following SQL statements:</p>
</div>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="void" border="1" rules="rows"><tbody><tr><td align="left" valign="top" width="54.699248120300744%"><p>ALTER SEQUENCE<br />
ALTER TABLE<br />
CALL <sup>2</sup><br />
CLOSE<br />
COMMENT ON<br />
COMMIT<br />
CREATE ALIAS<br />
CREATE DISTINCT TYPE<br />
CREATE FUNCTION<br />
CREATE INDEX<br />
CREATE PROCEDURE<br />
CREATE SCHEMA<br />
CREATE SEQUENCE<br />
CREATE TABLE<br />
CREATE TRIGGER<br />
CREATE VIEW<br />
DECLARE CURSOR  <sup>2</sup><br />
DECLARE GLOBAL TEMPORARY TABLE<br />
DELETE <sup>2</sup><br />
DESCRIBE<br />
DESCRIBE TABLE<br />
DROP</p>
</td>
<td align="left" valign="top" width="45.30075187969925%"><p>EXECUTE<br />
EXECUTE IMMEDIATE<br />
FETCH <sup>1</sup><br />
GRANT<br />
INSERT <sup>1</sup><br />
LABEL ON<br />
LOCK TABLE<br />
OPEN<br />
PREPARE<br />
REFRESH<br />
RELEASE SAVEPOINT<br />
RENAME<br />
REVOKE<br />
ROLLBACK<br />
SAVEPOINT<br />
SET ENCRYPTION PASSWORD<br />
SET OPTION <sup>3</sup><br />
SET PATH<br />
SET SCHEMA<br />
SET TRANSACTION<br />
SET variable <sup>2</sup><br />
UPDATE <sup>2</sup><br />
VALUES INTO <sup>2</sup></p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section"><p>The following SQL statements are not supported by the SQL/REXX
interface:</p>
</div>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="void" border="1" rules="rows"><tbody><tr><td align="left" valign="top" width="50%"><p>ALLOCATE DESCRIPTOR<br />
BEGIN DECLARE SECTION<br />
CONNECT<br />
DEALLOCATE DESCRIPTOR<br />
DECLARE PROCEDURE<br />
DECLARE STATEMENT<br />
DECLARE VARIABLE<br />
DESCRIBE INPUT<br />
DISCONNECT<br />
END DECLARE SECTION<br />
FREE LOCATOR<br />
GET DESCRIPTOR</p>
</td>
<td align="left" valign="top" width="50%"><p>GET DIAGNOSTICS<br />
HOLD LOCATOR<br />
INCLUDE<br />
RELEASE<br />
SELECT INTO<br />
SET CONNECTION<br />
SET CURRENT DEGREE<br />
SET DESCRIPTOR<br />
SET RESULT SETS<br />
SET SESSION AUTHORIZATION<br />
SIGNAL<br />
WHENEVER<sup>1</sup></p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section"><a name="fnsrc_1" href="#fntarg_1"><sup>1</sup></a><a name="fnsrc_2" href="#fntarg_2"><sup>2</sup></a><a name="fnsrc_3" href="#fntarg_3"><sup>3</sup></a></div>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="rzajpcommentsrexx.htm">Comments in REXX applications that use SQL</a></strong><br />
Neither SQL comments (--) nor REXX comments are allowed in strings representing SQL statements.</li>
<li class="ulchildlink"><strong><a href="rzajpcontinuationrexx.htm">Continuation of SQL statements in REXX applications that use SQL</a></strong><br />
The string containing an SQL statement can be split into several strings on several lines, separated by commas or concatenation operators, according to standard REXX usage.</li>
<li class="ulchildlink"><strong><a href="rzajpincludecoderexx.htm">Include code in REXX applications that use SQL</a></strong><br />
Unlike the other host languages, support is not provided for including externally defined statements.</li>
<li class="ulchildlink"><strong><a href="rzajpmarginsrexx.htm">Margins in REXX applications that use SQL</a></strong><br />
There are no special margin rules for the SQL/REXX interface.</li>
<li class="ulchildlink"><strong><a href="rzajpnamesrexx.htm">Names in REXX applications that use SQL</a></strong><br />
Any valid REXX name not ending in a period (.) can be used for a host variable. The name must be 64 characters or less.</li>
<li class="ulchildlink"><strong><a href="rzajpnullsrexx.htm">Nulls in REXX applications that use SQL</a></strong><br />
Although the term <em>null</em> is used in both REXX and SQL, the
term has different meanings in the two languages.</li>
<li class="ulchildlink"><strong><a href="rzajpstmtlabelsrexx.htm">Statement labels in REXX applications that use SQL</a></strong><br />
REXX command statements can be labeled as usual.</li>
<li class="ulchildlink"><strong><a href="rzajprxerr.htm">Handle errors and warnings in REXX applications that use SQL</a></strong><br />
The WHENEVER statement is not supported by the SQL/REXX interface. You can use one of several substitutes, however.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajprexx.htm" title="REXX procedures do not have to be preprocessed. At run time, the REXX interpreter passes statements that it does not understand to the current active command environment for processing.">Code SQL statements in REXX applications</a></div>
</div>
</div><div class="p"><a name="fntarg_1" href="#fnsrc_1"><sup>1</sup></a> The blocked form of this statement is not supported.</div><div class="p"><a name="fntarg_2" href="#fnsrc_2"><sup>2</sup></a> These
statements cannot be run directly if they contain host variables; they must
be the object of a PREPARE and then an EXECUTE.</div><div class="p"><a name="fntarg_3" href="#fnsrc_3"><sup>3</sup></a> The SET OPTION statement
can be used in a REXX procedure to change some of the processing options used
for running SQL statements. These options include the commitment control level
and date format. See the <a href="../db2/rbafzmst02.htm">SQL Reference</a> topic for more information about the <a href="../db2/rbafzmstsoption.htm">SET OPTION</a> statement.</div>
</body>
</html>