587 lines
30 KiB
HTML
587 lines
30 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 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>Casting between 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="castdt"></a>
|
||
|
<h2 id="castdt"><a href="rbafzmst02.htm#ToC_138">Casting between data types</a></h2>
|
||
|
<p>There are many occasions when a value with a given data type needs to be
|
||
|
cast (changed) to a different data type or to the same data type with a different
|
||
|
length, precision, or scale. Data type promotion, as described in <a href="rbafzmstpromo.htm#promo">Promotion of data types</a>,
|
||
|
is one example of when a value with one data type needs to be cast to a new
|
||
|
data type. A data type that can be changed to another data type is <span class="italic">castable</span> from the source data type to the target data type.</p>
|
||
|
<p>The casting of one data type to another can occur implicitly or explicitly.
|
||
|
The cast functions or CAST specification (see <a href="rbafzmstdatetimearith.htm#cast">CAST specification</a>) can be
|
||
|
used to explicitly change a data type. The database manager might implicitly
|
||
|
cast data types during assignments that involve a distinct type (see <a href="rbafzmstch2bas.htm#udtasgn">Distinct type assignments</a>). In addition, when you create a sourced user-defined function,
|
||
|
the data types of the parameters of the source function must be castable to
|
||
|
the data types of the function that you are creating (see <a href="rbafzmstcfso.htm#cfso">CREATE FUNCTION (Sourced)</a>).</p>
|
||
|
<p>If truncation occurs when a character or graphic string is cast to another
|
||
|
data type, a warning occurs if any non-blank characters are truncated. This
|
||
|
truncation behavior is similar to retrieval assignment of character or graphic
|
||
|
strings (see <a href="rbafzmstch2bas.htm#reta">Retrieval assignment</a>).</p>
|
||
|
<p>For casts that involve a distinct type as either the data type to be cast
|
||
|
to or from, <a href="rbafzmstcastdt.htm#castt1">Table 12</a> shows the supported casts. For casts between
|
||
|
built-in data types, <a href="rbafzmstcastdt.htm#opcast">Table 13</a> shows the supported casts.</p>
|
||
|
<a name="castt1"></a>
|
||
|
<table id="castt1" width="100%" summary="" border="1" frame="hsides" rules="all">
|
||
|
<caption>Table 12. Supported Casts When a Distinct Type is Involved</caption>
|
||
|
<thead valign="bottom">
|
||
|
<tr>
|
||
|
<th id="wq130" width="33%" align="left" valign="bottom">Data Type ...</th>
|
||
|
<th id="wq131" width="66%" align="left" valign="bottom">Is Castable to Data Type
|
||
|
...</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody valign="top">
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq130">Distinct type <span class="italic">DT</span></td>
|
||
|
<td align="left" valign="bottom" headers="wq131">Source data type of distinct type <span class="italic">DT</span></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq130">Source data type of distinct type <span class="italic">DT</span></td>
|
||
|
<td align="left" valign="bottom" headers="wq131">Distinct type <span class="italic">DT</span></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq130">Distinct type <span class="italic">DT</span></td>
|
||
|
<td align="left" valign="bottom" headers="wq131">Distinct type <span class="italic">DT</span></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq130">Data type <span class="italic">A</span></td>
|
||
|
<td align="left" valign="bottom" headers="wq131">Distinct type <span class="italic">DT</span> where <span class="italic">A</span> is promotable to the source data type of distinct type <span class="italic">DT</span> (see <a href="rbafzmstpromo.htm#promo">Promotion of data types</a>)</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq130">INTEGER</td>
|
||
|
<td align="left" valign="bottom" headers="wq131">Distinct type <span class="italic">DT</span> if <span class="italic">DT</span>'s source type is SMALLINT</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq130">DOUBLE</td>
|
||
|
<td align="left" valign="bottom" headers="wq131">Distinct type <span class="italic">DT</span> if <span class="italic">DT</span>'s source data type is REAL</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq130">VARCHAR</td>
|
||
|
<td align="left" valign="bottom" headers="wq131">Distinct type <span class="italic">DT</span> if <span class="italic">DT</span>'s source data type is CHAR or GRAPHIC</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq130">VARGRAPHIC</td>
|
||
|
<td align="left" valign="bottom" headers="wq131">Distinct type <span class="italic">DT</span> if <span class="italic">DT</span>'s source data type is GRAPHIC or CHAR</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq130">VARBINARY</td>
|
||
|
<td align="left" valign="bottom" headers="wq131">Distinct type <span class="italic">DT</span> if <span class="italic">DT</span>'s source data type is BINARY</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<p>When a distinct type is involved in a cast, a cast function that was generated
|
||
|
when the distinct type was created is used. How the database manager chooses the function
|
||
|
depends on whether function notation or the CAST specification syntax is used.
|
||
|
For details, see <a href="rbafzmstch2function.htm#funcres">Function resolution</a>, and <a href="rbafzmstdatetimearith.htm#cast">CAST specification</a>. Function
|
||
|
resolution is used for both. However, in a CAST specification, when an unqualified
|
||
|
distinct type is specified as the target data type, the database manager resolves
|
||
|
the schema name of the distinct type and then uses that schema name to locate
|
||
|
the cast function.</p>
|
||
|
<p>The following table describes the supported casts between built-in data
|
||
|
types.</p>
|
||
|
<a name="opcast"></a>
|
||
|
<table id="opcast" width="100%" summary="" border="1" frame="hsides" rules="rows">
|
||
|
<caption>Table 13. Supported Casts Between Built-In Data Types</caption>
|
||
|
<thead valign="bottom">
|
||
|
<tr>
|
||
|
<th id="wq132" width="25%" align="left" valign="bottom">
|
||
|
<div class="lines"> <br />
|
||
|
<br />
|
||
|
<br />
|
||
|
Target Data Type →<br />
|
||
|
<br />
|
||
|
<br />
|
||
|
<br />
|
||
|
Source Data Type ↓<br />
|
||
|
</div></th>
|
||
|
<th id="wq133" width="10%" align="left" valign="middle">
|
||
|
<div class="lines"> SMALLINT<br />
|
||
|
INTEGER<br />
|
||
|
BIGINT<br />
|
||
|
</div></th>
|
||
|
<th id="wq134" width="5%" align="left" valign="middle">
|
||
|
<div class="lines"> DECIMAL<br />
|
||
|
NUMERIC<br />
|
||
|
</div></th>
|
||
|
<th id="wq135" width="5%" align="left" valign="middle">
|
||
|
<div class="lines"> REAL<br />
|
||
|
DOUBLE<br />
|
||
|
</div></th>
|
||
|
<th id="wq136" width="10%" align="left" valign="middle">
|
||
|
<div class="lines"> CHAR<br />
|
||
|
VARCHAR<br />
|
||
|
CLOB<br />
|
||
|
</div></th>
|
||
|
<th id="wq137" width="10%" align="left" valign="middle">
|
||
|
<div class="lines"> GRAPHIC<br />
|
||
|
VARGRAPHIC<br />
|
||
|
DBCLOB<br />
|
||
|
</div></th>
|
||
|
<th id="wq138" width="10%" align="left" valign="middle">
|
||
|
<div class="lines"> BINARY<br />
|
||
|
VARBINARY<br />
|
||
|
BLOB<br />
|
||
|
</div></th>
|
||
|
<th id="wq139" width="5%" align="left" valign="middle">
|
||
|
<div class="lines"> DATE<br />
|
||
|
</div></th>
|
||
|
<th id="wq140" width="5%" align="left" valign="middle">
|
||
|
<div class="lines"> TIME<br />
|
||
|
</div></th>
|
||
|
<th id="wq141" width="5%" align="left" valign="middle">
|
||
|
<div class="lines"> TIMESTAMP<br />
|
||
|
</div></th>
|
||
|
<th id="wq142" width="5%" align="left" valign="middle">
|
||
|
<div class="lines"> ROWID<br />
|
||
|
</div></th>
|
||
|
<th id="wq143" width="5%" align="left" valign="middle">
|
||
|
<div class="lines"> DATALINK<br />
|
||
|
</div></th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody valign="top">
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq132">SMALLINT</td>
|
||
|
<td align="center" valign="bottom" headers="wq133">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq134">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq135">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq136">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq137">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq138">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq139">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq140">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq141">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq142">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq143">—</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq132">INTEGER</td>
|
||
|
<td align="center" valign="bottom" headers="wq133">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq134">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq135">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq136">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq137">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq138">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq139">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq140">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq141">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq142">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq143">—</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq132">BIGINT</td>
|
||
|
<td align="center" valign="bottom" headers="wq133">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq134">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq135">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq136">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq137">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq138">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq139">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq140">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq141">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq142">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq143">—</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq132">DECIMAL</td>
|
||
|
<td align="center" valign="bottom" headers="wq133">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq134">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq135">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq136">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq137">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq138">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq139">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq140">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq141">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq142">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq143">—</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq132">NUMERIC</td>
|
||
|
<td align="center" valign="bottom" headers="wq133">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq134">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq135">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq136">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq137">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq138">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq139">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq140">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq141">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq142">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq143">—</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq132">REAL</td>
|
||
|
<td align="center" valign="bottom" headers="wq133">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq134">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq135">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq136">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq137">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq138">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq139">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq140">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq141">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq142">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq143">—</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq132">DOUBLE</td>
|
||
|
<td align="center" valign="bottom" headers="wq133">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq134">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq135">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq136">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq137">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq138">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq139">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq140">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq141">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq142">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq143">—</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq132">CHAR</td>
|
||
|
<td align="center" valign="bottom" headers="wq133">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq134">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq135">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq136">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq137">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq138">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq139">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq140">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq141">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq142">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq143">—</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq132">VARCHAR</td>
|
||
|
<td align="center" valign="bottom" headers="wq133">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq134">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq135">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq136">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq137">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq138">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq139">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq140">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq141">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq142">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq143">—</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq132">CLOB</td>
|
||
|
<td align="center" valign="bottom" headers="wq133">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq134">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq135">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq136">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq137">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq138">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq139">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq140">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq141">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq142">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq143">—</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq132">GRAPHIC</td>
|
||
|
<td align="center" valign="bottom" headers="wq133">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq134">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq135">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq136">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq137">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq138">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq139">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq140">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq141">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq142">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq143">—</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq132">VARGRAPHIC</td>
|
||
|
<td align="center" valign="bottom" headers="wq133">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq134">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq135">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq136">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq137">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq138">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq139">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq140">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq141">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq142">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq143">—</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq132">DBCLOB</td>
|
||
|
<td align="center" valign="bottom" headers="wq133">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq134">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq135">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq136">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq137">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq138">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq139">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq140">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq141">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq142">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq143">—</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq132">BINARY</td>
|
||
|
<td align="center" valign="bottom" headers="wq133">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq134">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq135">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq136">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq137">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq138">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq139">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq140">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq141">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq142">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq143">—</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq132">VARBINARY</td>
|
||
|
<td align="center" valign="bottom" headers="wq133">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq134">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq135">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq136">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq137">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq138">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq139">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq140">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq141">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq142">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq143">—</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq132">BLOB</td>
|
||
|
<td align="center" valign="bottom" headers="wq133">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq134">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq135">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq136">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq137">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq138">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq139">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq140">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq141">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq142">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq143">—</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq132">DATE</td>
|
||
|
<td align="center" valign="bottom" headers="wq133">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq134">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq135">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq136">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq137">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq138">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq139">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq140">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq141">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq142">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq143">—</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq132">TIME</td>
|
||
|
<td align="center" valign="bottom" headers="wq133">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq134">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq135">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq136">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq137">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq138">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq139">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq140">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq141">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq142">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq143">—</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq132">TIMESTAMP</td>
|
||
|
<td align="center" valign="bottom" headers="wq133">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq134">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq135">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq136">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq137">Y<sup>1</sup></td>
|
||
|
<td align="center" valign="bottom" headers="wq138">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq139">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq140">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq141">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq142">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq143">—</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq132">ROWID</td>
|
||
|
<td align="center" valign="bottom" headers="wq133">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq134">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq135">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq136">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq137">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq138">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq139">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq140">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq141">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq142">Y</td>
|
||
|
<td align="center" valign="bottom" headers="wq143">—</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq132">DATALINK</td>
|
||
|
<td align="center" valign="bottom" headers="wq133">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq134">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq135">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq136">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq137">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq138">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq139">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq140">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq141">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq142">—</td>
|
||
|
<td align="center" valign="bottom" headers="wq143">Y</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td colspan="12" align="left" valign="top" headers="wq132 wq133 wq134 wq135 wq136 wq137 wq138 wq139 wq140 wq141 wq142 wq143">
|
||
|
<a name="wq144"></a>
|
||
|
<div class="notetitle" id="wq144">Notes:</div>
|
||
|
<div class="notebody">
|
||
|
<p><sup>1</sup> Conversion is only
|
||
|
supported for UTF-16 or UCS-2 graphic.</p></div></td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<p>The following table describes the rules for casting to a data type:</p>
|
||
|
<a name="opcast2"></a>
|
||
|
<table id="opcast2" width="100%" summary="" border="1" frame="hsides" rules="rows">
|
||
|
<caption>Table 14. Rules for Casting to a Data Type</caption>
|
||
|
<thead valign="bottom">
|
||
|
<tr>
|
||
|
<th id="wq145" width="25%" align="left" valign="bottom">Target Data Type</th>
|
||
|
<th id="wq146" width="75%" align="left" valign="bottom">Rules</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody valign="top">
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq145">SMALLINT</td>
|
||
|
<td align="left" valign="bottom" headers="wq146">See <a href="rbafzmstscale.htm#smifunc">SMALLINT</a>.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq145">INTEGER</td>
|
||
|
<td align="left" valign="bottom" headers="wq146">See <a href="rbafzmstscale.htm#intfunc">INTEGER or INT</a>.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq145">BIGINT</td>
|
||
|
<td align="left" valign="bottom" headers="wq146">See <a href="rbafzmstscale.htm#bigfunc">BIGINT</a>.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq145">DECIMAL</td>
|
||
|
<td align="left" valign="bottom" headers="wq146">See <a href="rbafzmstscale.htm#scadec">DECIMAL or DEC</a>.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq145">NUMERIC</td>
|
||
|
<td align="left" valign="bottom" headers="wq146">See <a href="rbafzmstscale.htm#scazoned">ZONED</a>.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq145">REAL</td>
|
||
|
<td align="left" valign="bottom" headers="wq146">See <a href="rbafzmstscale.htm#realfun">REAL</a>.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq145">DOUBLE</td>
|
||
|
<td align="left" valign="bottom" headers="wq146">See <a href="rbafzmstscale.htm#dblprc">DOUBLE_PRECISION or DOUBLE</a>.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq145">CHAR</td>
|
||
|
<td align="left" valign="bottom" headers="wq146">See <a href="rbafzmstscale.htm#scachar">CHAR</a>.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq145">VARCHAR</td>
|
||
|
<td align="left" valign="bottom" headers="wq146">See the <a href="rbafzmstscale.htm#scavarchar">VARCHAR</a>.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq145">CLOB</td>
|
||
|
<td align="left" valign="bottom" headers="wq146">See <a href="rbafzmstscale.htm#scaclob">CLOB</a>.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="top" headers="wq145">GRAPHIC</td>
|
||
|
<td align="left" valign="bottom" headers="wq146">
|
||
|
<p>If the source data type
|
||
|
is a character string, see the rules for string assignment to a variable in <a href="rbafzmstch2bas.htm#ch2bas">Assignments and comparisons</a>.</p>
|
||
|
<p>Otherwise, see <a href="rbafzmstscale.htm#scagraphic">GRAPHIC</a>.</p></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="top" headers="wq145">VARGRAPHIC</td>
|
||
|
<td align="left" valign="bottom" headers="wq146">
|
||
|
<p>If the source data type
|
||
|
is a character string, see the rules for string assignment to a variable in <a href="rbafzmstch2bas.htm#ch2bas">Assignments and comparisons</a>.</p>
|
||
|
<p>Otherwise, see <a href="rbafzmstscale.htm#scavargraph">VARGRAPHIC</a>.</p></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq145">DBCLOB</td>
|
||
|
<td align="left" valign="bottom" headers="wq146">See <a href="rbafzmstscale.htm#scadbclob">DBCLOB</a>.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq145">BINARY</td>
|
||
|
<td align="left" valign="bottom" headers="wq146">See <a href="rbafzmstscale.htm#scabinary">BINARY</a>.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq145">VARBINARY</td>
|
||
|
<td align="left" valign="bottom" headers="wq146">See <a href="rbafzmstscale.htm#scavarbinary">VARBINARY</a>.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq145">BLOB</td>
|
||
|
<td align="left" valign="bottom" headers="wq146">See <a href="rbafzmstscale.htm#scablob">BLOB</a>.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq145">DATE</td>
|
||
|
<td align="left" valign="bottom" headers="wq146">See <a href="rbafzmstscale.htm#scadate">DATE</a>.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq145">TIME</td>
|
||
|
<td align="left" valign="bottom" headers="wq146">See <a href="rbafzmstscale.htm#scatime">TIME</a>.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="top" headers="wq145">TIMESTAMP</td>
|
||
|
<td align="left" valign="bottom" headers="wq146">
|
||
|
<p>If the source data type
|
||
|
is a string, see <a href="rbafzmstscale.htm#scatimestamp">TIMESTAMP</a>, where one operand is specified.</p>
|
||
|
<p>If the source data type is a DATE, the timestamp is composed of the
|
||
|
specified date and a time of 00:00:00.</p>
|
||
|
<p>If the source data type is a
|
||
|
TIME, the timestamp is composed of the CURRENT_DATE and the specified time.</p></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq145">DATALINK</td>
|
||
|
<td align="left" valign="bottom" headers="wq146">See the rules for DataLink
|
||
|
assignments in <a href="rbafzmstch2bas.htm#ch2bas">Assignments and comparisons</a>.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="bottom" headers="wq145">ROWID</td>
|
||
|
<td align="left" valign="bottom" headers="wq146">See <a href="rbafzmstscale.htm#scarowid">ROWID</a>.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<hr /><br />
|
||
|
[ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzmstpromo.htm">Previous Page</a> | <a href="rbafzmstch2bas.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>
|