95 lines
5.8 KiB
HTML
95 lines
5.8 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="concept" />
|
||
|
<meta name="DC.Title" content="Use user-defined distinct types (UDT)" />
|
||
|
<meta name="abstract" content="A user-defined distinct type is a mechanism that allows you to extend DB2 capabilities beyond the built-in data types available." />
|
||
|
<meta name="description" content="A user-defined distinct type is a mechanism that allows you to extend DB2 capabilities beyond the built-in data types available." />
|
||
|
<meta name="DC.subject" content="data types, user-defined, UDTs (User-defined types), why use UDTs" />
|
||
|
<meta name="keywords" content="data types, user-defined, UDTs (User-defined types), why use UDTs" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafyusoocap.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafydefudt.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafydetab.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafymanudt.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafyexampudt.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafyusrdeftype.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="rbafyuddt" />
|
||
|
<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>Use user-defined distinct types (UDT)</title>
|
||
|
</head>
|
||
|
<body id="rbafyuddt"><a name="rbafyuddt"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Use user-defined distinct types (UDT)</h1>
|
||
|
<div><p>A user-defined distinct type is a mechanism that allows you to
|
||
|
extend DB2<sup>®</sup> capabilities
|
||
|
beyond the built-in data types available.</p>
|
||
|
<p> User-defined distinct types enable you to define new data types to DB2 which
|
||
|
gives you considerable power since you are no longer restricted to using the
|
||
|
system-supplied built-in data types to model your business and capture the
|
||
|
semantics of your data. Distinct data types allow you to map on a one-to-one
|
||
|
basis to existing database types.</p>
|
||
|
<p>These benefits are associated with UDTs: </p>
|
||
|
<ul><li><strong>Extensibility</strong>. <p>By defining new types, you can indefinitely
|
||
|
increase the set of types provided by DB2 to support your applications. </p>
|
||
|
</li>
|
||
|
<li><strong>Flexibility</strong>. <p>You can specify any semantics and behavior for
|
||
|
your new type by using user-defined functions (UDFs) to augment the diversity
|
||
|
of the types available in the system. </p>
|
||
|
</li>
|
||
|
<li><strong>Consistent behavior</strong>. <p>Strong typing insures that your UDTs
|
||
|
will behave appropriately. It guarantees that only functions defined on your
|
||
|
UDT can be applied to instances of the UDT. </p>
|
||
|
</li>
|
||
|
<li><strong>Encapsulation</strong>. <p>The behavior of your UDTs is restricted by
|
||
|
the functions and operators that can be applied on them. This provides flexibility
|
||
|
in the implementation since running applications do not depend on the internal
|
||
|
representation that you chose for your type. </p>
|
||
|
</li>
|
||
|
<li><strong>Extensible behavior</strong>. <p>The definition of user-defined functions
|
||
|
on types can augment the functionality provided to manipulate your UDT at
|
||
|
any time. </p>
|
||
|
</li>
|
||
|
<li><strong>Foundation for object-oriented extensions</strong>. <p>UDTs are the foundation
|
||
|
for most object-oriented features. They represent the most important step
|
||
|
toward object-oriented extensions. </p>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div>
|
||
|
<ul class="ullinks">
|
||
|
<li class="ulchildlink"><strong><a href="rbafydefudt.htm">Define a UDT</a></strong><br />
|
||
|
UDTs are defined with a CREATE DISTINCT TYPE statement.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafydetab.htm">Define tables with UDTs</a></strong><br />
|
||
|
After you have defined several UDTs, you can start defining tables with columns whose types are UDTs.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafymanudt.htm">Manipulate UDTs</a></strong><br />
|
||
|
One of the most important concepts associated with UDTs is <em>strong
|
||
|
typing</em>. Strong typing guarantees that only functions and operators defined
|
||
|
on the UDT can be applied to its instances.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafyexampudt.htm">Examples: Use UDTs</a></strong><br />
|
||
|
These are examples of using UDTs.</li>
|
||
|
</ul>
|
||
|
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafyusoocap.htm" title="Most data types, such as INTEGER and CHARACTER, do not have any special processing characteristics. However, there are a few data types that require special functions or locators in order to use them.">Process special data types</a></div>
|
||
|
</div>
|
||
|
<div class="relconcepts"><strong>Related concepts</strong><br />
|
||
|
<div><a href="rbafyusrdeftype.htm" title="A user-defined type is a distinct data type that users can define independently of those supplied by the database management system.">User-defined types</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|