forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Lu, Huayi <luhuayi@huawei.com> Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
32 lines
4.9 KiB
HTML
32 lines
4.9 KiB
HTML
<a name="EN-US_TOPIC_0000001188429108"></a><a name="EN-US_TOPIC_0000001188429108"></a>
|
|
|
|
<h1 class="topictitle1">CLOSE</h1>
|
|
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001188429108__s8ffa7be2bd0e48e58c3d97f5abada595"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0000001188429108__a261b9b30ef574e3b890e18ea638244f3"><strong id="EN-US_TOPIC_0000001188429108__b37551745115420">CLOSE</strong> frees the resources associated with an open cursor.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001188429108__sff08ff24ccf14a5b9a2f525b60fddf70"><h4 class="sectiontitle">Precautions</h4><ul id="EN-US_TOPIC_0000001188429108__u6dc52fb4af7f4734b7210b7da715022a"><li id="EN-US_TOPIC_0000001188429108__l0eae9ed4498d4a069c334441b9563a8d">After a cursor is closed, no subsequent operations are allowed on it.</li><li id="EN-US_TOPIC_0000001188429108__l7dedd0751ade47eebf4d5abc10993312">A cursor should be closed when it is no longer needed.</li><li id="EN-US_TOPIC_0000001188429108__l786154231bb34e56a9e58187a7e86510">Every non-holdable open cursor is implicitly closed when a transaction is terminated by <strong id="EN-US_TOPIC_0000001188429108__b10807926115420">COMMIT</strong> or <strong id="EN-US_TOPIC_0000001188429108__b30162476115420">ROLLBACK</strong>.</li><li id="EN-US_TOPIC_0000001188429108__l13aeb6ff2abe4dd9a2cd3849ab0e3e0e">A holdable cursor is implicitly closed if the transaction that created it aborts via <strong id="EN-US_TOPIC_0000001188429108__b27241502115420">ROLLBACK</strong>.</li><li id="EN-US_TOPIC_0000001188429108__l8af1d11a6fa641dc93578a73dc488309">If the creating transaction successfully commits, the holdable cursor remains open until an explicit <strong id="EN-US_TOPIC_0000001188429108__en-us_topic_0085031759_b59078077115420">CLOSE</strong> is executed, or the client disconnects.</li><li id="EN-US_TOPIC_0000001188429108__l46e060f0824144e28cc6202f9c13b2d1"><span id="EN-US_TOPIC_0000001188429108__text1975652344">GaussDB(DWS)</span> does not have an explicit <strong id="EN-US_TOPIC_0000001188429108__en-us_topic_0058966045_b3730687111271">OPEN</strong> cursor statement. A cursor is considered open when it is declared. You can see all available cursors by querying the <strong id="EN-US_TOPIC_0000001188429108__b1958203524111646">pg_cursors</strong> system view.</li></ul>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001188429108__s19d40ecdbc844ffe8e829fcd74a33a67"><h4 class="sectiontitle">Syntax</h4><div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188429108__s45fc88b93a344330879417dfebfc5155"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">CLOSE</span><span class="w"> </span><span class="err">{</span><span class="w"> </span><span class="k">cursor_name</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">ALL</span><span class="w"> </span><span class="err">}</span><span class="w"> </span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001188429108__s4b4307bfc2dd401b950f70a728fcef2c"><h4 class="sectiontitle">Parameter Description</h4><ul id="EN-US_TOPIC_0000001188429108__ufa4c1955e0264107b5d9af38e956d9f8"><li id="EN-US_TOPIC_0000001188429108__l46e886a9c51b449ba2f9ebce254be8a2"><strong id="EN-US_TOPIC_0000001188429108__acddffa29181c4a258543bb71a8fc83fe">cursor_name</strong><p id="EN-US_TOPIC_0000001188429108__aea41eede5f8a4fe9bfc973853bce0c98">Specifies the name of a cursor to be closed.</p>
|
|
</li><li id="EN-US_TOPIC_0000001188429108__lc54ada40a71c42ebbdc144b7408e687d"><strong id="EN-US_TOPIC_0000001188429108__ab45ae2d2d67b45cdab22c8aec380bc30">ALL</strong><p id="EN-US_TOPIC_0000001188429108__a56d77ce3c70c40a6a3e83e1844ba81fd">Closes all open cursors.</p>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001188429108__s1bcfffae7c924335be3185c48c09bf39"><h4 class="sectiontitle">Example</h4><p id="EN-US_TOPIC_0000001188429108__p196275613141">Close a cursor.</p>
|
|
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188429108__screen17944161815142"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">CLOSE</span><span class="w"> </span><span class="k">ALL</span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001188429108__s7cc72012ac844b3baa7685f4791edac5"><h4 class="sectiontitle">Links</h4><p id="EN-US_TOPIC_0000001188429108__a396563dc49894f4491e720b7e46aaf88"><a href="dws_06_0216.html">FETCH</a>, <a href="dws_06_0217.html">MOVE</a></p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_06_0118.html">DDL Syntax</a></div>
|
|
</div>
|
|
</div>
|
|
|