ibm-information-center/dist/eclipse/plugins/i5OS.ic.db2_5.4.0.1/rbafzmstpromo.htm

164 lines
6.4 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 xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="dc.language" scheme="rfc1766" 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. -->
<meta name="dc.date" scheme="iso8601" content="2005-09-19" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<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))' />
<title>Promotion of data types</title>
<link rel="stylesheet" type="text/css" href="ibmidwb.css" />
<link rel="stylesheet" type="text/css" href="ic.css" />
</head>
<body>
<a id="Top_Of_Page" name="Top_Of_Page"></a><!-- Java sync-link -->
<script language = "Javascript" src = "../rzahg/synch.js" type="text/javascript"></script>
<a name="promo"></a>
<h2 id="promo"><a href="rbafzmst02.htm#ToC_137">Promotion of data types</a></h2>
<p>Data types can be classified into groups of related data types. Within
such groups, an order of precedence exists where one data type is considered
to precede another data type. This precedence enables the database manager to support the <span class="italic">promotion</span> of one data type to another data type that appears
later in the precedence ordering. For example, the data type CHAR can be promoted
to VARCHAR; INTEGER can be promoted to DOUBLE PRECISION; but CLOB is NOT promotable
VARCHAR.</p>
<p>The database manager considers the promotion of data types when: </p>
<ul>
<li>performing function resolution (see <a href="rbafzmstch2function.htm#funcres">Function resolution</a>)</li>
<li>casting distinct types (see <a href="rbafzmstcastdt.htm#castdt">Casting between data types</a>)</li>
<li>assigning distinct types to built-in data types (see <a href="rbafzmstch2bas.htm#udtasgn">Distinct type assignments</a>)</li></ul>
<p>For each data type, <a href="rbafzmstpromo.htm#promot1">Table 11</a> shows the precedence list (in
order) that the database manager uses to determine the data types to which each data type
can be promoted. The table indicates that the best choice is the same data
type and not promotion to another data type. Note that the table also shows
data types that are considered equivalent during the promotion process. For
example, CHARACTER and GRAPHIC are considered to be equivalent data types.</p>
<a name="promot1"></a>
<table id="promot1" width="100%" summary="" border="1" frame="hsides" rules="rows">
<caption>Table 11. Data Type Precedence Table</caption>
<thead valign="bottom">
<tr>
<th id="wq127" width="20%" align="left">Data Type</th>
<th id="wq128" width="80%" align="left">Data Type Precedence List (in best-to-worst order)</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td headers="wq127">SMALLINT</td>
<td headers="wq128">SMALLINT, INTEGER, BIGINT, decimal, real, double</td>
</tr>
<tr>
<td headers="wq127">INTEGER</td>
<td headers="wq128">INTEGER, BIGINT, decimal, real, double</td>
</tr>
<tr>
<td align="left" valign="bottom" headers="wq127">BIGINT</td>
<td align="left" valign="bottom" headers="wq128">BIGINT, decimal, real, double</td>
</tr>
<tr>
<td headers="wq127">decimal</td>
<td headers="wq128">decimal, real, double</td>
</tr>
<tr>
<td headers="wq127">real</td>
<td headers="wq128">real, double</td>
</tr>
<tr>
<td headers="wq127">double</td>
<td headers="wq128">double</td>
</tr>
<tr>
<td headers="wq127"><span>CHAR or GRAPHIC</span></td>
<td headers="wq128"><span>CHAR or GRAPHIC, VARCHAR or VARGRAPHIC, CLOB or DBCLOB</span></td>
</tr>
<tr>
<td headers="wq127"><span>VARCHAR or VARGRAPHIC</span></td>
<td headers="wq128"><span>VARCHAR or VARGRAPHIC, CLOB or DBCLOB</span></td>
</tr>
<tr>
<td headers="wq127"><span>CLOB or DBCLOB</span></td>
<td headers="wq128"><span>CLOB or DBCLOB</span></td>
</tr>
<tr>
<td headers="wq127"><span>BINARY</span></td>
<td headers="wq128"><span>BINARY, VARBINARY, BLOB</span></td>
</tr>
<tr>
<td headers="wq127"><span>VARBINARY</span></td>
<td headers="wq128"><span>VARBINARY, BLOB</span></td>
</tr>
<tr>
<td headers="wq127">BLOB</td>
<td headers="wq128">BLOB</td>
</tr>
<tr>
<td headers="wq127">DATE</td>
<td headers="wq128">DATE</td>
</tr>
<tr>
<td headers="wq127">TIME</td>
<td headers="wq128">TIME</td>
</tr>
<tr>
<td headers="wq127">TIMESTAMP</td>
<td headers="wq128">TIMESTAMP</td>
</tr>
<tr>
<td headers="wq127">DATALINK</td>
<td headers="wq128">DATALINK</td>
</tr>
<tr>
<td headers="wq127">ROWID</td>
<td headers="wq128">ROWID</td>
</tr>
<tr>
<td headers="wq127">udt</td>
<td headers="wq128">same udt</td>
</tr>
<tr>
<td colspan="2" headers="wq127 wq128">
<a name="wq129"></a>
<div class="notetitle" id="wq129">Note:</div>
<div class="notebody"></div>
<p>The lower case
types above are defined as follows: </p>
<dl>
<dt class="bold">decimal</dt>
<dd>= DECIMAL(p,s) or NUMERIC(p,s)
</dd>
<dt class="bold">real</dt>
<dd>= REAL or FLOAT(<span class="italic">n</span>) where <span class="italic">n</span> is a specification for single precision floating point
</dd>
<dt class="bold">double</dt>
<dd>= DOUBLE, DOUBLE PRECISION, FLOAT or FLOAT(<span class="italic">n</span>)
where <span class="italic">n</span> is a specification for double precision floating
point
</dd>
<dt class="bold">udt</dt>
<dd>= a user-defined type
</dd>
</dl>
<p>Shorter and longer form synonyms of the data types listed are
considered to be the same as the synonym listed.</p>
<p><span>Character and
graphic strings are only compatible for Unicode data.</span></p></td>
</tr>
</tbody>
</table>
<hr /><br />
[ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzmstch2data.htm">Previous Page</a> | <a href="rbafzmstcastdt.htm">Next Page</a> | <a href="rbafzmst02.htm#wq1">Contents</a> |
<a href="rbafzmstindex.htm#index">Index</a> ]
<a id="Bot_Of_Page" name="Bot_Of_Page"></a>
</body>
</html>