63 lines
3.9 KiB
HTML
63 lines
3.9 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 function to populate the database" />
|
|
<meta name="abstract" content="Suppose you populate your table by transferring your e-mail that is maintained in files into DB2 UDB for iSeries." />
|
|
<meta name="description" content="Suppose you populate your table by transferring your e-mail that is maintained in files into DB2 UDB for iSeries." />
|
|
<meta name="DC.subject" content="examples, LOB function to populate the database, LOBs (Large Objects), LOB function to populate the database example" />
|
|
<meta name="keywords" content="examples, LOB function to populate the database, LOBs (Large Objects), LOB function to populate the database 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="rbafyexplob" />
|
|
<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 function to populate the database</title>
|
|
</head>
|
|
<body id="rbafyexplob"><a name="rbafyexplob"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Example: Use LOB function to populate the database</h1>
|
|
<div><p><span>Suppose you populate your table
|
|
by transferring your e-mail that is maintained in files into DB2<sup>®</sup> UDB for <span class="keyword">iSeries™</span>.</span></p>
|
|
<div class="section"><p>Run the following INSERT statement multiple times with different
|
|
values of the HV_EMAIL_FILE until you have stored all your e-mail:</p>
|
|
<pre> EXEC SQL <strong>BEGIN DECLARE SECTION</strong>
|
|
<strong>SQL TYPE IS</strong> BLOB_FILE HV_EMAIL_FILE;
|
|
|
|
EXEC SQL <strong>END DECLARE SECTION</strong>
|
|
strcpy (HV_EMAIL_FILE.NAME, "/u/mail/email/mbox");
|
|
HV_EMAIL_FILE.NAME_LENGTH = strlen(HV_EMAIL_FILE.NAME);
|
|
HV_EMAIL_FILE.FILE_OPTIONS = 2;
|
|
|
|
EXEC SQL <strong>INSERT INTO</strong> ELECTRONIC_MAIL
|
|
<strong>VALUES</strong> (CURRENT TIMESTAMP, :hv_email_file);</pre>
|
|
</div>
|
|
<div class="section"><p>All the function provided by DB2 LOB support is applicable to UDTs whose
|
|
source type are LOBs. Therefore, you have used LOB file reference variables
|
|
to assign the contents of the file into the UDT column. You have not used
|
|
the cast function to convert values of BLOB type into your e-mail type. This
|
|
is because DB2 allows
|
|
you to assign values of the source type of a distinct type to targets of the
|
|
distinct type.</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> |