71 lines
4.4 KiB
HTML
71 lines
4.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 LOB locators to manipulate UDT instances" />
|
|
<meta name="abstract" content="Suppose you want to obtain information about a specific e-mail without having to transfer the entire e-mail into a host variable in your application program." />
|
|
<meta name="description" content="Suppose you want to obtain information about a specific e-mail without having to transfer the entire e-mail into a host variable in your application program." />
|
|
<meta name="DC.subject" content="UDTs (User-defined types), LOB locators to manipulate UDT instances example, examples, LOB locators to manipulate UDT instances, LOBs (Large Objects), LOB locators to manipulate UDT instances example" />
|
|
<meta name="keywords" content="UDTs (User-defined types), LOB locators to manipulate UDT instances example, examples, LOB locators to manipulate UDT instances, LOBs (Large Objects), LOB locators to manipulate UDT instances example" />
|
|
<meta name="DC.Relation" scheme="URI" content="rbafyexampcomplex.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="rbafyexplobl" />
|
|
<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 LOB locators to manipulate UDT instances</title>
|
|
</head>
|
|
<body id="rbafyexplobl"><a name="rbafyexplobl"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Example: Use LOB locators to manipulate UDT instances</h1>
|
|
<div><p>Suppose you want to obtain information about a specific e-mail
|
|
without having to transfer the entire e-mail into a host variable in your
|
|
application program.</p>
|
|
<div class="section"><p>Remember that an e-mail can be quite large. Since your UDT is
|
|
defined as a LOB, you can use LOB locators for that purpose:</p>
|
|
<pre> EXEC SQL <strong>BEGIN DECLARE SECTION</strong>
|
|
long hv_len;
|
|
char hv_subject[200];
|
|
char hv_sender[200];
|
|
char hv_buf[4096];
|
|
char hv_current_time[26];
|
|
<strong>SQL TYPE IS</strong> BLOB_LOCATOR hv_email_locator;
|
|
EXEC SQL <strong>END DECLARE SECTION</strong>
|
|
|
|
EXEC SQL <strong>SELECT</strong> MESSAGE
|
|
<strong>INTO</strong> :hv_email_locator
|
|
<strong>FROM</strong> ELECTRONIC MAIL
|
|
<strong>WHERE</strong> ARRIVAL_TIMESTAMP = :hv_current_time;
|
|
|
|
EXEC SQL <strong>VALUES</strong> (SUBJECT (E_MAIL(:hv_email_locator))
|
|
<strong>INTO</strong> :hv_subject;
|
|
.... code that checks if the subject of the e_mail is relevant ....
|
|
.... if the e_mail is relevant, then...............................
|
|
|
|
EXEC SQL <strong>VALUES</strong> (SENDER (CAST (:hv_email_locator AS E_MAIL)))
|
|
<strong>INTO</strong> :hv_sender;</pre>
|
|
</div>
|
|
<div class="section"><p>Because your host variable is of type BLOB locator (the source
|
|
type of the UDT), you have explicitly converted the BLOB locator to your UDT,
|
|
whenever it was used as an argument of a UDF defined on the UDT. </p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafyexampcomplex.htm" title="The following examples show how you can use user-defined types (UDTs), user-defined functions (UDFs), and large objects (LOBs) together in complex applications.">Examples of using UDTs, UDFs, and LOBs</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |