<?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 xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-us"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="dc.language" scheme="rfc1766" 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. --> <meta name="dc.date" scheme="iso8601" content="2005-09-19" /> <meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" /> <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="keywords" content="HOLD LOCATOR statement, HOLD LOCATOR, SQL statements, locator, in HOLD LOCATOR statement, variable" /> <title>HOLD LOCATOR</title> <link rel="stylesheet" type="text/css" href="ibmidwb.css" /> <link rel="stylesheet" type="text/css" href="ic.css" /> </head> <body> <a id="Top_Of_Page" name="Top_Of_Page"></a><!-- Java sync-link --> <script language = "Javascript" src = "../rzahg/synch.js" type="text/javascript"></script> <a name="holdloc"></a> <h2 id="holdloc"><a href="rbafzmst02.htm#ToC_1140">HOLD LOCATOR</a></h2><a id="idx2849" name="idx2849"></a><a id="idx2850" name="idx2850"></a><a id="idx2851" name="idx2851"></a> <p>The HOLD LOCATOR statement allows a LOB locator variable to retain its association with a value beyond a unit of work.</p> <a name="wq1614"></a> <h3 id="wq1614"><a href="rbafzmst02.htm#ToC_1141">Invocation</a></h3> <p>This statement can only be embedded in an application program. It cannot be issued interactively. It is an executable statement that can be dynamically prepared. However, the EXECUTE statement with the USING clause must be used to execute the prepared statement. HOLD LOCATOR cannot be used with the EXECUTE IMMEDIATE statement. It must not be specified in REXX.</p> <a name="wq1615"></a> <h3 id="wq1615"><a href="rbafzmst02.htm#ToC_1142">Authorization</a></h3> <p>None required.</p> <a name="wq1616"></a> <h3 id="wq1616"><a href="rbafzmst02.htm#ToC_1143">Syntax</a></h3> <a href="rbafzmstholdloc.htm#synshl"><img src="c.gif" alt="Click to skip syntax diagram" /></a> <pre class="cgraphic"><span><img src="c.gif" alt="Read syntax diagram" longdesc="rbafzmstsyn355.htm" border="0" /></span><a href="#skipsyn-354"><img src="c.gif" alt="Skip visual syntax diagram" border="0" /></a> .-,--------. V | >>-HOLD LOCATOR----<span><span class="italic">variable</span></span>-+---------------------------------->< </pre> <a name="skipsyn-354" id="skipsyn-354"></a> <a name="synshl"></a> <h3 id="synshl"><a href="rbafzmst02.htm#ToC_1144">Description</a></h3> <dl class="parml"> <dt class="bold"><var class="pv">variable,...</var> </dt><a id="idx2852" name="idx2852"></a> <dd>Identifies a variable that must be declared in accordance with the rules for declaring variable locator variables. An indicator variable must not be specified. The locator variable type must be a binary large object locator, a character large object locator, or a double-byte character large object locator. <p>After the HOLD LOCATOR statement is executed, each locator variable in the <var class="pv">variable</var> list has the hold property.</p> <p>The variable must currently have a locator assigned to it. That is, a locator must have been assigned during this unit of work (by a CALL, FETCH, SELECT INTO, SET variable, or VALUES INTO statement) and must not subsequently have been freed (by a FREE LOCATOR statement); otherwise, an error is raised.</p> <p>If more than one variable is specified in the HOLD LOCATOR statement and an error occurs on one of the locators, no locators will be held.</p> </dd> </dl> <a name="wq1617"></a> <h3 id="wq1617"><a href="rbafzmst02.htm#ToC_1145">Note</a></h3> <p>A LOB locator variable that has the hold property is freed (has its association between it and its value removed) when:</p> <ul> <li>The SQL FREE LOCATOR statement is executed for the locator variable.</li> <li>The SQL ROLLBACK statement without a HOLD option is executed.</li> <li>The SQL session is terminated.</li></ul> <a name="wq1618"></a> <h3 id="wq1618"><a href="rbafzmst02.htm#ToC_1146">Example</a></h3> <p>Assume that the employee table contains columns RESUME, HISTORY, and PICTURE and that locators have been established in a program to represent the values represented by the columns. Give the CLOB locator variables LOCRES and LOCHIST, and the BLOB locator variable LOCPIC the hold property.</p> <pre class="xmp"> <span class="bold">HOLD LOCATOR</span> :LOCRES,:LOCHIST,:LOCPIC</pre><a id="idx2853" name="idx2853"></a><a id="idx2854" name="idx2854"></a> <hr /><br /> [ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzmstgnt.htm">Previous Page</a> | <a href="rbafzmstclucu.htm">Next Page</a> | <a href="rbafzmst02.htm#wq1">Contents</a> | <a href="rbafzmstindex.htm#index">Index</a> ] <a id="Bot_Of_Page" name="Bot_Of_Page"></a> </body> </html>