ibm-information-center/dist/eclipse/plugins/i5OS.ic.sqlp_5.4.0.1/rbafyloblocators.htm

83 lines
5.8 KiB
HTML
Raw 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="concept" />
<meta name="DC.Title" content="Understand large object locators" />
<meta name="abstract" content="Large object (LOB) locators use a small, easily managed value to refer to a much larger value." />
<meta name="description" content="Large object (LOB) locators use a small, easily managed value to refer to a much larger value." />
<meta name="DC.subject" content="LOBs (Large Objects), locators, programming options for values" />
<meta name="keywords" content="LOBs (Large Objects), locators, programming options for values" />
<meta name="DC.Relation" scheme="URI" content="rbafylobs.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafylobrefvar.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafyexampclob.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="rbafyloblocators" />
<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>Understand large object locators</title>
</head>
<body id="rbafyloblocators"><a name="rbafyloblocators"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Understand large object locators</h1>
<div><p>Large object (LOB) locators use a small, easily managed value to
refer to a much larger value.</p>
<p>Specifically, a LOB locator is a 4 byte value stored in a host variable
that a program uses to refer to a LOB value held in the database system.
Using a LOB locator, a program can manipulate the LOB value as if the LOB
value was stored in a regular host variable. When you use the LOB locator,
there is no need to transport the LOB value from the server to the application
(and possibly back again). </p>
<p>The LOB locator is associated with a LOB value, not a row or physical
storage location in the database. Therefore, after selecting a LOB value
into a locator, you cannot perform an operation on the original row(s) or
table(s) that have any effect on the value referenced by the locator. The
value associated with the locator is valid until the unit of work ends, or
the locator is explicitly freed, whichever comes first. The FREE LOCATOR
statement releases a locator from its associated value. In a similar way,
a commit or rollback operation frees all LOB locators associated with the
transaction. </p>
<p>LOB locators can also be passed to and returned from UDFs. Within the UDF,
those functions that work on LOB data can be used to manipulate the LOB values
using LOB locators.</p>
<p>When selecting a LOB value, you have three options.</p>
<div class="p"><ul><li>Select the entire LOB value into a host variable. The entire LOB value
is copied into the host variable.</li>
<li>Select the LOB value into a LOB locator. The LOB value remains on the
server; it is not copied to the host variable.</li>
<li>Select the entire LOB value into a file reference variable. The LOB value
is moved to an Integrated File System (IFS) file. </li>
</ul>
How a LOB value is used within the program can help the
programmer to determine which method is best. If the LOB value is very large
and is needed only as an input value for one or more subsequent SQL statements,
keep the value in a locator.</div>
<p>If the program needs the entire LOB value regardless of the size, then
there is no choice but to transfer the LOB. Even in this case, there are
still options available to you. You can select the entire value into a regular
or file reference host variable. You may also select the LOB value into
a locator and read it piecemeal from the locator into a regular host variable.</p>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafylobs.htm" title="The VARCHAR, VARGRAPHIC, and VARBINARY data types have a limit of 32 KB (where KB equals 1024 bytes) of storage. While this may be sufficient for small to medium-size text data, applications often need to store large text documents. They might also need to store a wide variety of additional data types such as audio, video, drawings, mixed text and graphics, and images. There are three data types to store these data objects as strings of up to 2 GB (where GB equals 1 073 741 824 bytes).">Use large objects (LOBs)</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="rbafylobrefvar.htm" title="File reference variables are similar to host variables except that they are used to transfer data to and from IFS files (not to and from memory buffers).">LOB file reference variables</a></div>
<div><a href="rbafyexampclob.htm" title="In this example, the application program retrieves a locator for a LOB value; then it uses the locator to extract the data from the LOB value.">Example: Use a locator to work with a CLOB value</a></div>
</div>
</div>
</body>
</html>