69 lines
4.0 KiB
HTML
69 lines
4.0 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="Step 6: Close the cursor" />
|
||
|
<meta name="abstract" content="If you processed the rows of a result table for a serial cursor, and you want to use the cursor again, issue a CLOSE statement to close the cursor prior to re-opening it." />
|
||
|
<meta name="description" content="If you processed the rows of a result table for a serial cursor, and you want to use the cursor again, issue a CLOSE statement to close the cursor prior to re-opening it." />
|
||
|
<meta name="DC.subject" content="cursor, closing, example, examples, closing a cursor" />
|
||
|
<meta name="keywords" content="cursor, closing, example, examples, closing a cursor" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafycursorexamp.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="rbafycurs6" />
|
||
|
<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>Step 6: Close the cursor</title>
|
||
|
</head>
|
||
|
<body id="rbafycurs6"><a name="rbafycurs6"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Step 6: Close the cursor</h1>
|
||
|
<div><p>If you processed the rows of a result table for a serial cursor,
|
||
|
and you want to use the cursor again, issue a CLOSE statement to close the
|
||
|
cursor prior to re-opening it.</p>
|
||
|
<div class="section"><p>The statement looks like this:</p>
|
||
|
<pre>EXEC SQL
|
||
|
<strong>CLOSE</strong> cursor-name
|
||
|
END-EXEC.</pre>
|
||
|
</div>
|
||
|
<div class="section"><p>If you processed the rows of a result table and you do not want
|
||
|
to use the cursor again, you can let the system close the cursor. The system
|
||
|
automatically closes the cursor when:</p>
|
||
|
<ul><li>A COMMIT without HOLD statement is issued and the cursor is not declared
|
||
|
using the WITH HOLD clause.</li>
|
||
|
<li>A ROLLBACK without HOLD statement is issued.</li>
|
||
|
<li>The job ends.</li>
|
||
|
<li>The activation group ends and CLOSQLCSR(*ENDACTGRP) was specified on the
|
||
|
precompile.</li>
|
||
|
<li>The first SQL program in the call stack ends and neither CLOSQLCSR(*ENDJOB)
|
||
|
or CLOSQLCSR(*ENDACTGRP) was specified when the program was precompiled.</li>
|
||
|
<li>The connection to the application server is ended using the DISCONNECT
|
||
|
statement.</li>
|
||
|
<li>The connection to the application server was released and a successful
|
||
|
COMMIT occurred.</li>
|
||
|
<li>An *RUW CONNECT occurred. <p>Because an open cursor still holds locks
|
||
|
on referred-to-tables or views, you should explicitly close any open cursors
|
||
|
as soon as they are no longer needed.</p>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafycursorexamp.htm" title="Suppose your program examines data about people in department D11. The following examples show the SQL statements you would include in a program to define and use a serial and a scrollable cursor.">Examples: Use a cursor</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|