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

77 lines
5.8 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 SQL descriptor areas in RPG/400 applications that use SQL" />
<meta name="abstract" content="There are two types of SQL descriptor areas. One is defined with the ALLOCATE DESCRIPTOR statement. The other is defined using the SQLDA structure. In this topic, only the SQLDA form is discussed." />
<meta name="description" content="There are two types of SQL descriptor areas. One is defined with the ALLOCATE DESCRIPTOR statement. The other is defined using the SQLDA structure. In this topic, only the SQLDA form is discussed." />
<meta name="DC.subject" content="SQLDA (SQL descriptor area), RPG/400, application program, SQLDA, RPG/400 program, using the SQLDA, dynamic SQL coding, dynamic SQL, coding in RPG/400" />
<meta name="keywords" content="SQLDA (SQL descriptor area), RPG/400, application program, SQLDA, RPG/400 program, using the SQLDA, dynamic SQL coding, dynamic SQL, coding in RPG/400" />
<meta name="DC.Relation" scheme="URI" content="rzajprpg.htm" />
<meta name="DC.Relation" scheme="URI" content="../sqlp/rbafydynmic.htm" />
<meta name="DC.Relation" scheme="URI" content="../db2/rbafzmstsqldda.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="rzajpsqldarpg" />
<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 SQL descriptor areas in RPG/400 applications that use SQL</title>
</head>
<body id="rzajpsqldarpg"><a name="rzajpsqldarpg"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Define SQL descriptor areas in RPG/400 applications that use SQL</h1>
<div><p><span><img src="./delta.gif" alt="Start of change" />There are two types of SQL descriptor areas.
One is defined with the ALLOCATE DESCRIPTOR statement. The other is defined
using the SQLDA structure. In this topic, only the SQLDA form is discussed.<img src="./deltaend.gif" alt="End of change" /></span></p>
<div class="section"> <p><img src="./delta.gif" alt="Start of change" />The following statements can use an SQLDA:<img src="./deltaend.gif" alt="End of change" /></p>
<ul><li>EXECUTE…USING DESCRIPTOR <span class="synph"><span class="var">descriptor-name</span></span></li>
<li>FETCH…USING DESCRIPTOR <span class="synph"><span class="var">descriptor-name</span></span></li>
<li>OPEN…USING DESCRIPTOR <span class="synph"><span class="var">descriptor-name</span></span></li>
<li>CALL…USING DESCRIPTOR <span class="synph"><span class="var">descriptor-name</span></span></li>
<li>DESCRIBE <span class="synph"><span class="var">statement-name</span></span> INTO <span class="synph"><span class="var">descriptor-name</span></span></li>
<li><img src="./delta.gif" alt="Start of change" />DESCRIBE INPUT <span class="synph"><span class="var">statement-name</span></span> INTO <span class="synph"><span class="var">descriptor-name</span></span><img src="./deltaend.gif" alt="End of change" /></li>
<li>DESCRIBE TABLE <span class="synph"><span class="var">host-variable</span></span> INTO <span class="synph"><span class="var">descriptor-name</span></span></li>
<li>PREPARE <span class="synph"><span class="var">statement-name</span></span> INTO <span class="synph"><span class="var">descriptor-name</span></span></li>
</ul>
</div>
<div class="section"><p><img src="./delta.gif" alt="Start of change" />Unlike the SQLCA, there can be more than one
SQLDA in a program and an SQLDA can have any valid name.<img src="./deltaend.gif" alt="End of change" /></p>
<p>Dynamic SQL
is an advanced programming technique.
With dynamic SQL, your program can develop and then run SQL statements while
the program is running. A SELECT statement with a variable SELECT list (that
is, a list of the data to be returned as part of the query) that runs dynamically
requires an SQL descriptor area (SQLDA). This is because you cannot know in
advance how many or what type of variables to allocate in order to receive
the results of the SELECT.</p>
</div>
<div class="section"><p>Because the SQLDA uses pointer variables which are not supported
by RPG/400<sup>®</sup>,
an INCLUDE SQLDA statement cannot be specified in an RPG/400 program. An SQLDA must be set
up by a C, COBOL, PL/I, or ILE RPG program and passed to the RPG program in
order to use it.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajprpg.htm" title="The RPG/400 licensed program supports both RPG II and RPG III programs.">Code SQL statements in RPG/400 applications</a></div>
</div>
<div class="relinfo"><strong>Related information</strong><br />
<div><a href="../sqlp/rbafydynmic.htm">Dynamic SQL applications</a></div>
<div><a href="../db2/rbafzmstsqldda.htm">SQL descriptor area</a></div>
</div>
</div>
</body>
</html>