137 lines
8.9 KiB
HTML
137 lines
8.9 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="SQLParamOptions - Specify an input array for a parameter" />
|
|
<meta name="DC.subject" content="SQLParamOptions, function, description, Parameter Options, function" />
|
|
<meta name="keywords" content="SQLParamOptions, function, description, Parameter Options, function" />
|
|
<meta name="DC.Relation" scheme="URI" content="rzadphdapi.htm" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1999, 2006" />
|
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1999, 2006" />
|
|
<meta name="DC.Format" content="XHTML" />
|
|
<meta name="DC.Identifier" content="rzadpfnpopt" />
|
|
<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>SQLParamOptions</title>
|
|
</head>
|
|
<body id="rzadpfnpopt"><a name="rzadpfnpopt"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">SQLParamOptions - Specify an input array for a parameter</h1>
|
|
<div><div class="section"><h4 class="sectiontitle">Purpose</h4><p><samp class="codeph">SQLParamOptions()</samp> provides
|
|
the ability to set multiple values for each parameter set by <samp class="codeph">SQLBindParameter()</samp>.
|
|
This allows the application to insert multiple rows into a table on a single
|
|
call to <samp class="codeph">SQLExecute()</samp> or <samp class="codeph">SQLExecDirect()</samp>. </p>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Syntax</h4><div class="p">
|
|
<pre>SQLRETURN SQLParamOptions (SQLHSTMT StatementHandle,
|
|
SQLINTEGER Crow,
|
|
SQLINTEGER *FetchOffsetPtr); </pre>
|
|
</div>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Function arguments</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="hsides" border="1" rules="all"><caption>Table 1. SQLParamOptions arguments</caption><thead align="left"><tr><th align="left" valign="bottom" width="27.881040892193308%" id="d0e59">Data type</th>
|
|
<th align="left" valign="bottom" width="20.63197026022305%" id="d0e61">Argument </th>
|
|
<th align="left" valign="bottom" width="10.223048327137546%" id="d0e63">Use </th>
|
|
<th align="left" valign="bottom" width="41.2639405204461%" id="d0e65">Description </th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr><td align="left" valign="top" width="27.881040892193308%" headers="d0e59 ">SQLHSTMT </td>
|
|
<td align="left" valign="top" width="20.63197026022305%" headers="d0e61 "><em>StatementHandle</em> </td>
|
|
<td align="left" valign="top" width="10.223048327137546%" headers="d0e63 ">Input </td>
|
|
<td align="left" valign="top" width="41.2639405204461%" headers="d0e65 ">Statement handle.</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="27.881040892193308%" headers="d0e59 ">SQLINTEGER </td>
|
|
<td align="left" valign="top" width="20.63197026022305%" headers="d0e61 "><em>Crow </em> </td>
|
|
<td align="left" valign="top" width="10.223048327137546%" headers="d0e63 ">Input </td>
|
|
<td align="left" valign="top" width="41.2639405204461%" headers="d0e65 ">Number of values for each parameter. If this
|
|
is greater than 1, then the <span class="synph"><span class="var">rgbValue</span></span> argument in <samp class="codeph">SQLBindParameter()</samp> points
|
|
to an array of parameter values, and <span class="synph"><span class="var">pcbValue</span></span> points
|
|
to an array of lengths.</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="27.881040892193308%" headers="d0e59 ">SQLINTEGER *</td>
|
|
<td align="left" valign="top" width="20.63197026022305%" headers="d0e61 "><em>FetchOffsetPtr</em> </td>
|
|
<td align="left" valign="top" width="10.223048327137546%" headers="d0e63 ">Output (deferred)</td>
|
|
<td align="left" valign="top" width="41.2639405204461%" headers="d0e65 "> Not currently used.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Usage</h4><p>This function can be used
|
|
with <samp class="codeph">SQLBindParameter()</samp> to set up a multiple-row INSERT statement.
|
|
In order to accomplish this, the application must allocate storage for all
|
|
of the data being inserted. This data must be organized in a row-wise fashion.
|
|
This means that all of the data for the first row is contiguous, followed
|
|
by all the data for the next row, and so on. The <samp class="codeph">SQLBindParameter()</samp> function
|
|
should be used to bind all of the input parameter types and lengths. In the
|
|
case of a multiple-row INSERT statement, the addresses provided on <samp class="codeph">SQLBindParameter()</samp> are
|
|
used to reference the first row of data. All subsequent rows of data are referenced
|
|
by incrementing those addresses by the length of the entire row.</p>
|
|
<p>For
|
|
instance, the application intends to insert 100 rows of data into a table,
|
|
and each row contains a 4-byte integer value, followed by a 10-byte character
|
|
value. To do this, the application allocates 1400 bytes of storage, and fills
|
|
each 14-byte piece of storage with the appropriate data for the row.</p>
|
|
<p>Also, the indicator pointer passed on the <samp class="codeph">SQLBindParameter()</samp> must
|
|
reference an 800-byte piece of storage. This is used to pass in any null
|
|
indicator values. This storage is also row-wise, so the first 8 bytes are
|
|
the 2 indicators for the first row, followed by the 2 indicators for the next
|
|
row, and so on. The <samp class="codeph">SQLParamOptions()</samp> function is used by
|
|
the application to specify how many rows are inserted on the next processing
|
|
of an INSERT statement using the statement handle. The INSERT statement must
|
|
be of the multiple-row form. For example:</p>
|
|
<pre> INSERT INTO CORPDATA.NAMES ? ROWS VALUES(?, ?)</pre>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Return codes</h4><div class="p"> <ul><li>SQL_SUCCESS </li>
|
|
<li>SQL_SUCCESS_WITH_INFO </li>
|
|
<li>SQL_ERROR </li>
|
|
<li>SQL_INVALID_HANDLE </li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Error conditions</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="hsides" border="1" rules="rows"><caption>Table 2. SQLParamOptions SQLSTATEs</caption><thead align="left"><tr><th align="left" valign="bottom" width="12.962962962962962%" id="d0e168">SQLSTATE </th>
|
|
<th align="left" valign="bottom" width="29.074074074074076%" id="d0e170">Description </th>
|
|
<th align="left" valign="bottom" width="57.96296296296296%" id="d0e172">Explanation </th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr><td align="left" valign="top" width="12.962962962962962%" headers="d0e168 "><strong>HY</strong>009 </td>
|
|
<td align="left" valign="top" width="29.074074074074076%" headers="d0e170 "> Argument value that is not valid</td>
|
|
<td align="left" valign="top" width="57.96296296296296%" headers="d0e172 ">The value in the argument <span class="synph"><span class="var">Crow</span></span> is
|
|
less than 1.</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="12.962962962962962%" headers="d0e168 "><strong>HY</strong>010 </td>
|
|
<td align="left" valign="top" width="29.074074074074076%" headers="d0e170 "> Function sequence error</td>
|
|
<td align="left" valign="top" width="57.96296296296296%" headers="d0e172 ">The function is called while in a data-at-processing
|
|
(<samp class="codeph">SQLParamData()</samp>, <samp class="codeph">SQLPutData()</samp>) operation. </td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Restrictions</h4><p> None. </p>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">References</h4><div class="p"> <ul><li><a href="rzadpfnbndpa.htm#rzadpfnbndpa">SQLBindParam - Bind a buffer to a parameter marker</a></li>
|
|
<li><a href="rzadpfnmrset.htm#rzadpfnmrset">SQLMoreResults - Determine whether there are more result sets</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzadphdapi.htm" title="This topic provides a description of each CLI function.">DB2 UDB CLI functions</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |