Edit D:\app\Administrator\product\11.2.0\dbhome_1\oc4j\j2ee\oc4j_applications\applications\em\em\online_help\tdddg\tdddg_subprograms039.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <script src="./callback.js" type="text/javascript"></script> <noscript>Your browser does not support JavaScript. This help page requires JavaScript to render correctly.</noscript> </head> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 005" /> <meta name="date" content="2009-04-21T9:46:24Z" /> <meta name="robots" content="noarchive" /> <meta name="doctitle" content="About Cursor Variables" /> <meta name="relnum" content="11g Release 2 (11.2)" /> <meta name="partnum" content="E10766-01" /> <link rel="copyright" href="./dcommon/html/cpyr.htm" title="Copyright" type="text/html" /> <link rel="stylesheet" href="./dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" /> <link rel="contents" href="toc.htm" title="Contents" type="text/html" /> <link rel="prev" href="tdddg_subprograms038.htm" title="Previous" type="text/html" /> <link rel="next" href="tdddg_subprograms040.htm" title="Next" type="text/html" /> <title>About Cursor Variables</title> </head> <body> <div class="zz-skip-header"><a href="#BEGIN">Skip Headers</a></div> <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%"> <col width="86%" /> <col width="*" /> <tr valign="bottom"> <td align="left"></td> <td align="center"><a href="tdddg_subprograms038.htm"><img width="24" height="24" src="./dcommon/gifs/leftnav.gif" alt="Previous" /><br /> <span class="icon">Previous</span></a> </td> <td align="center"><a href="tdddg_subprograms040.htm"><img width="24" height="24" src="./dcommon/gifs/rightnav.gif" alt="Next" /><br /> <span class="icon">Next</span></a></td> </tr> </table> <p><a id="BABEIDAC" name="BABEIDAC"></a><a id="TDDDG99939" name="TDDDG99939"></a></p> <div class="sect2"><!-- infolevel="all" infotype="General" --> <h1>About Cursor Variables</h1> <a name="BEGIN" id="BEGIN"></a> <p>A <a id="sthref478" name="sthref478"></a><span class="bold">cursor variable</span> is like a cursor (see <a href="tdddg_subprograms036.htm#BABJBEGE">"About Cursors"</a>), except that it is not limited to one query. You can open a cursor variable for a query, process the result set, and then use the cursor variable for another query. Cursor variables are useful for passing query results between <a id="sthref479" name="sthref479"></a>subprograms.</p> <p>To declare a cursor variable, you declare a <a id="sthref480" name="sthref480"></a><code>REF</code> <code>CURSOR</code> type, and then declare a variable of that type (therefore, a cursor variable is often called a <code>REF</code> <code>CURSOR</code>). A <code>REF</code> <code>CURSOR</code> type can be either strong or weak.</p> <p>A <a id="sthref481" name="sthref481"></a><span class="bold">strong</span> <code><span class="codeinlinebold">REF</span></code> <code><span class="codeinlinebold">CURSOR</span></code> <span class="bold">type</span> specifies a <a id="sthref482" name="sthref482"></a><a id="sthref483" name="sthref483"></a><span class="bold">return type</span>, which is the <code>RECORD</code> type of its cursor variables. The PL/SQL compiler does not allow you to use these <a id="sthref484" name="sthref484"></a><span class="bold">strongly typed</span> cursor variables for queries that return rows that are not of the return type. Strong <code>REF</code> <code>CURSOR</code> types are less error-prone than weak ones, but weak ones are more flexible.</p> <p>A <a id="sthref485" name="sthref485"></a><span class="bold">weak</span> <code><span class="codeinlinebold">REF</span></code> <code><span class="codeinlinebold">CURSOR</span></code> <span class="bold">type</span> does not specify a return type. The PL/SQL compiler accepts <a id="sthref486" name="sthref486"></a><span class="bold">weakly typed</span> cursor variables in any queries. Weak <code>REF</code> <code>CURSOR</code> types are interchangeable; therefore, instead of creating weak <code>REF</code> <code>CURSOR</code> types, you can use the predefined type weak cursor type <a id="sthref487" name="sthref487"></a><code>SYS_REFCURSOR</code>.</p> <p>After declaring a cursor variable, you must open it for a specific query (with the <code>OPEN</code> <code>FOR</code> statement), fetch rows one at a time from the result set (with the <code>FETCH</code> statement), and then either close the cursor (with the <code>CLOSE</code> statement) or open it for another specific query (with the <code>OPEN</code> <code>FOR</code> statement). Opening the cursor variable for another query closes it for the previous query. After closing a cursor variable for a specific query, you can neither fetch records from the result set of that query nor see the cursor attribute values for that query.</p> <div class="helpinfonotealso"> <h2>Related Topics</h2> <p><a href="javascript:open('http://www.oracle.com/pls/db112/lookup?id=LNPLS00605','newWindow').focus()"><span class="italic">Oracle Database PL/SQL Language Reference</span></a> for more information about using cursor variables</p> <p><a href="javascript:open('http://www.oracle.com/pls/db112/lookup?id=LNPLS01312','newWindow').focus()"><span class="italic">Oracle Database PL/SQL Language Reference</span></a> for the syntax of cursor variable declaration</p> <p><a href="tdddg_subprograms032.htm#CIHHCJDI">Using Records and Cursors</a></p> </div> </div> <!-- class="sect2" --> <!-- Start Footer --> <div class="footer"> <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%"> <col width="86%" /> <col width="*" /> <tr> <td align="left"><span class="copyrightlogo">Copyright © 1996, 2009, Oracle and/or its affiliates. All rights reserved.</span><br /> <a href="./dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td> <td align="center"><a href="tdddg_subprograms038.htm"><img width="24" height="24" src="./dcommon/gifs/leftnav.gif" alt="Previous" /><br /> <span class="icon">Previous</span></a> </td> <td align="center"><a href="tdddg_subprograms040.htm"><img width="24" height="24" src="./dcommon/gifs/rightnav.gif" alt="Next" /><br /> <span class="icon">Next</span></a></td> </tr> </table> </div> <!-- class="footer" --> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de