78 lines
5.4 KiB
HTML
78 lines
5.4 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="Example: Use a locator to work with a CLOB value" />
|
||
|
<meta name="abstract" content="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." />
|
||
|
<meta name="description" content="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." />
|
||
|
<meta name="DC.subject" content="LOBs (Large Objects), locators, example of using, examples, using a locator to work with a CLOB value" />
|
||
|
<meta name="keywords" content="LOBs (Large Objects), locators, example of using, examples, using a locator to work with a CLOB value" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafylobs.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafyllocc.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafyllocb.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafyloblocators.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="rbafyexampclob" />
|
||
|
<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>Example: Use a locator to work with a CLOB value</title>
|
||
|
</head>
|
||
|
<body id="rbafyexampclob"><a name="rbafyexampclob"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Example: Use a locator to work with a CLOB value</h1>
|
||
|
<div><p>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.</p>
|
||
|
<div class="section"><p>Using this method, the program allocates only enough storage for
|
||
|
one piece of LOB data (the size is determined by the program). In addition,
|
||
|
the program needs to issue only one fetch call using the cursor.</p>
|
||
|
</div>
|
||
|
<div class="section"><h4 class="sectiontitle">How the sample LOBLOC program works</h4> <ol><li><strong>Declare host variables.</strong> The BEGIN DECLARE SECTION and END DECLARE
|
||
|
SECTION statements delimit the host variable declarations. Host variables
|
||
|
are prefixed with a colon (:) when referenced in an SQL statement. CLOB
|
||
|
LOCATOR host variables are declared. </li>
|
||
|
<li><strong>Fetch the LOB value into the locator host variable.</strong> A CURSOR and
|
||
|
FETCH routine is used to obtain the location of a LOB field in the database
|
||
|
to a locator host variable. </li>
|
||
|
<li><strong>Free the LOB LOCATORS.</strong> The LOB LOCATORS used in this example are
|
||
|
freed, releasing the locators from their previously associated values.</li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
<div class="section"><p>The CHECKERR macro/function is an error checking utility that
|
||
|
is external to the program. The location of this error checking utility depends
|
||
|
on the programming language that is used. In this example, C language is
|
||
|
used so check_error is redefined as CHECKERR and is located in the util.c
|
||
|
file.</p>
|
||
|
</div>
|
||
|
<div class="section"> <div class="note"><span class="notetitle">Note:</span> By using the code examples, you agree to the terms of the <a href="codedisclaimer.htm">Code license and disclaimer information</a>.</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<ul class="ullinks">
|
||
|
<li class="ulchildlink"><strong><a href="rbafyllocc.htm">Example: LOBLOC.SQC in C</a></strong><br />
|
||
|
</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafyllocb.htm">Example: LOBLOC.SQB in COBOL</a></strong><br />
|
||
|
</li>
|
||
|
</ul>
|
||
|
|
||
|
<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="relconcepts"><strong>Related concepts</strong><br />
|
||
|
<div><a href="rbafyloblocators.htm" title="Large object (LOB) locators use a small, easily managed value to refer to a much larger value.">Understand large object locators</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|