ibm-information-center/dist/eclipse/plugins/i5OS.ic.cli_5.4.0.1/rzadpfnnump.htm

134 lines
8.6 KiB
HTML
Raw Permalink 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="SQLNumParams - Get number of parameters in an SQL statement" />
<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="rzadpfnnump" />
<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>SQLNumParams</title>
</head>
<body id="rzadpfnnump"><a name="rzadpfnnump"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">SQLNumParams - Get number of parameters in an SQL statement</h1>
<div><div class="section"><h4 class="sectiontitle">Purpose</h4> <p><samp class="codeph">SQLNumParams()</samp> returns
the number of parameter markers in an SQL statement.</p>
</div>
<div class="section"><h4 class="sectiontitle">Syntax</h4><pre>SQLRETURN SQLNumParams (SQLHSTMT StatementHandle,
SQLSMALLINT *ParameterCountPtr);</pre>
</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. SQLNumParams arguments</caption><thead align="left"><tr><th align="left" valign="bottom" width="30.52434456928839%" id="d0e47">Data type</th>
<th align="left" valign="bottom" width="19.662921348314608%" id="d0e49">Argument </th>
<th align="left" valign="bottom" width="11.797752808988763%" id="d0e51">Use </th>
<th align="left" valign="bottom" width="38.01498127340824%" id="d0e53">Description </th>
</tr>
</thead>
<tbody><tr><td align="left" valign="top" width="30.52434456928839%" headers="d0e47 ">SQLHSTMT </td>
<td align="left" valign="top" width="19.662921348314608%" headers="d0e49 "><em>StatementHandle</em> </td>
<td align="left" valign="top" width="11.797752808988763%" headers="d0e51 ">Input </td>
<td align="left" valign="top" width="38.01498127340824%" headers="d0e53 ">Statement handle.</td>
</tr>
<tr><td align="left" valign="top" width="30.52434456928839%" headers="d0e47 ">SQLSMALLINT *</td>
<td align="left" valign="top" width="19.662921348314608%" headers="d0e49 "><em>ParameterCountPtr</em> </td>
<td align="left" valign="top" width="11.797752808988763%" headers="d0e51 ">Output </td>
<td align="left" valign="top" width="38.01498127340824%" headers="d0e53 ">Number of parameters in the statement.</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section"><h4 class="sectiontitle">Usage</h4><p>This function can only be called after the
statement that is associated with <span class="synph"><span class="var">StatementHandle</span></span> has
been prepared. If the statement does not contain any parameter markers, <span class="synph"><span class="var">ParameterCountPtr</span></span> is
set to 0.</p>
<p> An application can call this function to determine how many <samp class="codeph">SQLBindParameter()</samp> calls
are necessary for the SQL statement associated with the statement handle. </p>
</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_STILL_EXECUTING</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. SQLNumParams SQLSTATEs</caption><thead align="left"><tr><th align="left" valign="bottom" width="12.962962962962962%" id="d0e128">SQLSTATE </th>
<th align="left" valign="bottom" width="29.074074074074076%" id="d0e130">Description </th>
<th align="left" valign="bottom" width="57.96296296296296%" id="d0e132">Explanation </th>
</tr>
</thead>
<tbody><tr><td align="left" valign="top" width="12.962962962962962%" headers="d0e128 "><strong>40</strong>003 <strong>08</strong>S01</td>
<td align="left" valign="top" width="29.074074074074076%" headers="d0e130 ">Communication link failure</td>
<td align="left" valign="top" width="57.96296296296296%" headers="d0e132 ">The communication link between the application
and data source fails before the function is completed.</td>
</tr>
<tr><td align="left" valign="top" width="12.962962962962962%" headers="d0e128 "><strong>HY</strong>001</td>
<td align="left" valign="top" width="29.074074074074076%" headers="d0e130 ">Memory allocation failure</td>
<td align="left" valign="top" width="57.96296296296296%" headers="d0e132 ">DB2<sup>®</sup> UDB CLI is unable to allocate memory
required to support the processing or completion of the function.</td>
</tr>
<tr><td align="left" valign="top" width="12.962962962962962%" headers="d0e128 "><strong>HY</strong>008</td>
<td align="left" valign="top" width="29.074074074074076%" headers="d0e130 ">Operation canceled</td>
<td align="left" valign="top" width="57.96296296296296%" headers="d0e132 ">&nbsp;</td>
</tr>
<tr><td align="left" valign="top" width="12.962962962962962%" headers="d0e128 "><strong>HY</strong>009 </td>
<td align="left" valign="top" width="29.074074074074076%" headers="d0e130 ">Argument value that is not valid</td>
<td align="left" valign="top" width="57.96296296296296%" headers="d0e132 "><span class="synph"><span class="var">ParameterCountPtr</span></span> is
null.</td>
</tr>
<tr><td align="left" valign="top" width="12.962962962962962%" headers="d0e128 "><strong>HY</strong>010 </td>
<td align="left" valign="top" width="29.074074074074076%" headers="d0e130 ">Function sequence error</td>
<td align="left" valign="top" width="57.96296296296296%" headers="d0e132 "> This function is called before <samp class="codeph">SQLPrepare()</samp> is
called for the specified <span class="synph"><span class="var">StatementHandle</span></span> <p>The
function is called while in a data-at-processing (<samp class="codeph">SQLParamData()</samp>, <samp class="codeph">SQLPutData()</samp>)
operation.</p>
</td>
</tr>
<tr><td align="left" valign="top" width="12.962962962962962%" headers="d0e128 "><strong>HY</strong>013 </td>
<td align="left" valign="top" width="29.074074074074076%" headers="d0e130 ">Unexpected memory handling error</td>
<td align="left" valign="top" width="57.96296296296296%" headers="d0e132 ">DB2 UDB CLI is unable to access memory required
to support the processing or completion of the function.</td>
</tr>
<tr><td align="left" valign="top" width="12.962962962962962%" headers="d0e128 "><strong>HY</strong>T00 </td>
<td align="left" valign="top" width="29.074074074074076%" headers="d0e130 ">Timeout expired</td>
<td align="left" valign="top" width="57.96296296296296%" headers="d0e132 ">&nbsp;</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section"><h4 class="sectiontitle">Restrictions</h4><p> None.</p>
</div>
<div class="section"><h4 class="sectiontitle">Example</h4></div>
<div class="example" id="rzadpfnnump__xmnump"><a name="rzadpfnnump__xmnump"><!-- --></a><p> Refer to the <samp class="codeph">SQLNativeSql()</samp> <a href="rzadpfnnsql.htm#rzadpfnnsql__xmnsql">rzadpfnnsql.htm#rzadpfnnsql__xmnsql</a>.</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="rzadpfnprep.htm#rzadpfnprep">SQLPrepare - Prepare a statement</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>