ibm-information-center/dist/eclipse/plugins/i5OS.ic.sqlp_5.4.0.1/rbafyprocesssqlda.htm

82 lines
6.5 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<?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="Process SELECT statements and use a descriptor" />
<meta name="abstract" content="There are two basic types of SELECT statements: fixed list and varying list." />
<meta name="description" content="There are two basic types of SELECT statements: fixed list and varying list." />
<meta name="DC.subject" content="dynamic SQL, varying-list SELECT statement, SELECT statement, processing and using SQLDA, SQLDA (SQL descriptor area), processing SELECT statement, DESCRIBE statement, use with dynamic SQL" />
<meta name="keywords" content="dynamic SQL, varying-list SELECT statement, SELECT statement, processing and using SQLDA, SQLDA (SQL descriptor area), processing SELECT statement, DESCRIBE statement, use with dynamic SQL" />
<meta name="DC.Relation" scheme="URI" content="rbafydynmic.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafyfixed.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafyvarlst.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafysqlda.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafysqldaformat.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafydynexample.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafyallocexample.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafypmaker.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="rbafyprocesssqlda" />
<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>Process SELECT statements and use a descriptor</title>
</head>
<body id="rbafyprocesssqlda"><a name="rbafyprocesssqlda"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Process SELECT statements and use a descriptor</h1>
<div><p>There are two basic types of SELECT statements: <strong>fixed list</strong> and <strong>varying
list</strong>. </p>
<div class="section"><p>To process a fixed-list SELECT statement, an SQL descriptor is
not necessary.</p>
</div>
<div class="section"><p><img src="./delta.gif" alt="Start of change" />To process a varying-list SELECT statement, you
must first declare an SQL descriptor area (SQLDA) structure or ALLOCATE an
SQLDA. Both forms of SQL descriptors can be used to pass host
variable input values from an application program to SQL and to receive output
values from SQL. In addition, information about SELECT list expressions can
be returned in a PREPARE or DESCRIBE statement.<img src="./deltaend.gif" alt="End of change" /></p>
</div>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="rbafyfixed.htm">Fixed-list SELECT statements</a></strong><br />
In dynamic SQL, fixed-list SELECT statements are those statements designed to retrieve data of a predictable number and type. When using these statements, you can anticipate and define host variables to accommodate the retrieved data so that an SQL descriptor area (SQLDA) is not necessary.</li>
<li class="ulchildlink"><strong><a href="rbafyvarlst.htm">Varying-list SELECT statements</a></strong><br />
In dynamic SQL, varying-list SELECT statements are ones for which the number and format of result columns to be returned are not predictable; that is, you do not know how many variables you need, or what the data types are.</li>
<li class="ulchildlink"><strong><a href="rbafysqlda.htm">SQL descriptor areas</a></strong><br />
Dynamic SQL uses an SQL descriptor area (SQLDA) to pass information about an SQL statement between SQL and your application. A descriptor is required for running the DESCRIBE, DESCRIBE INPUT and DESCRIBE TABLE statements, and can also be used on the PREPARE, OPEN, FETCH, CALL, and EXECUTE statements.</li>
<li class="ulchildlink"><strong><a href="rbafysqldaformat.htm">SQLDA format</a></strong><br />
The SQLDA consists of four variables followed by an arbitrary number of occurrences of a sequence of six variables collectively named SQLVAR.</li>
<li class="ulchildlink"><strong><a href="rbafydynexample.htm">Example: Select-statement for allocating storage for SQLDA</a></strong><br />
<span>Suppose your application needs to be able
to handle a dynamic SELECT statement, one that changes from one use to the
next. This statement can be read from a display, passed in from another application,
or built dynamically by your application.</span></li>
<li class="ulchildlink"><strong><a href="rbafyallocexample.htm">Example: Select statement using an allocated SQL descriptor</a></strong><br />
<span>Suppose your application needs to be able
to handle a dynamic SELECT statement; one that changes from one use to the
next. This statement can be read from a display, passed from another application,
or built dynamically by your application.</span></li>
<li class="ulchildlink"><strong><a href="rbafypmaker.htm">Parameter markers</a></strong><br />
In the example used, the SELECT statement that was dynamically run had a constant value in the WHERE clause.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafydynmic.htm" title="Dynamic SQL allows an application to define and run SQL statements at program run time. An application that provides for dynamic SQL accepts as input (or builds) an SQL statement in the form of a character string. The application does not need to know what type of SQL statement it will run.">Dynamic SQL applications</a></div>
</div>
</div>
</body>
</html>