259 lines
11 KiB
HTML
259 lines
11 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>Conversion rules for operations that combine strings</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="uuall"></a>
|
||
|
<h2 id="uuall"><a href="rbafzmst02.htm#ToC_183">Conversion rules for operations that combine strings</a></h2>
|
||
|
<p>The operations that combine strings are concatenation, UNION, UNION ALL,
|
||
|
EXCEPT, and INTERSECT. (These rules also apply to the MAX, MIN, VALUE, COALESCE,
|
||
|
IFNULL, and CONCAT scalar functions and CASE expressions.) In each case, the
|
||
|
CCSID of the result is determined at bind time, and the execution of the operation
|
||
|
may involve conversion of strings to the coded character set identified by
|
||
|
that CCSID.</p>
|
||
|
<p>The CCSID of the result is determined by the CCSIDs of the operands. The
|
||
|
CCSIDs of the first two operands determine an intermediate result CCSID, this
|
||
|
CCSID and the CCSID of the next operand determine a new intermediate result
|
||
|
CCSID, and so on. The last intermediate result CCSID and the CCSID of the
|
||
|
last operand determine the CCSID of the result string or column. For each
|
||
|
pair of CCSIDs, the result CCSID is determined by the sequential application
|
||
|
of the following rules: </p>
|
||
|
<ul>
|
||
|
<li>If the CCSIDs are equal, the result is that CCSID.</li>
|
||
|
<li>If either CCSID is 65535, the result is 65535.<sup class="fn"><a id="wq252" name="wq252" href="rbafzmstuuall.htm#wq253">25</a></sup></li>
|
||
|
<li>If one CCSID denotes data in an encoding scheme different from the other
|
||
|
CCSID, the result is determined by the following table:</li></ul>
|
||
|
<a name="wq254"></a>
|
||
|
<table id="wq254" width="100%" summary="" border="1" frame="border" rules="all">
|
||
|
<caption>Table 20. Selecting the Encoding Scheme of the Intermediate Result</caption>
|
||
|
<thead valign="bottom">
|
||
|
<tr>
|
||
|
<th id="wq255" width="20%" rowspan="2" align="center" valign="bottom">First Operand</th>
|
||
|
<th id="wq256" colspan="4" align="center" valign="bottom">Second
|
||
|
Operand</th>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<th id="wq257" width="20%" align="center" valign="bottom">SBCS Data</th>
|
||
|
<th id="wq258" width="20%" align="center" valign="bottom">DBCS Data</th>
|
||
|
<th id="wq259" width="20%" align="center" valign="bottom">Mixed Data</th>
|
||
|
<th id="wq260" width="20%" align="center" valign="bottom">UTF-16 or UCS-2 Data</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody valign="top">
|
||
|
<tr>
|
||
|
<td align="left" valign="top" headers="wq255">SBCS Data</td>
|
||
|
<td align="center" valign="top" headers="wq256 wq257">see below</td>
|
||
|
<td align="center" valign="top" headers="wq256 wq258">second</td>
|
||
|
<td align="center" valign="top" headers="wq256 wq259">second</td>
|
||
|
<td align="center" valign="top" headers="wq256 wq260">second</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="top" headers="wq255">DBCS Data</td>
|
||
|
<td align="center" valign="top" headers="wq256 wq257">first</td>
|
||
|
<td align="center" valign="top" headers="wq256 wq258">see below</td>
|
||
|
<td align="center" valign="top" headers="wq256 wq259">second</td>
|
||
|
<td align="center" valign="top" headers="wq256 wq260">second</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="top" headers="wq255">Mixed Data</td>
|
||
|
<td align="center" valign="top" headers="wq256 wq257">first</td>
|
||
|
<td align="center" valign="top" headers="wq256 wq258">first</td>
|
||
|
<td align="center" valign="top" headers="wq256 wq259">see below</td>
|
||
|
<td align="center" valign="top" headers="wq256 wq260">second</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="top" headers="wq255">UTF-16 or UCS-2 Data</td>
|
||
|
<td align="center" valign="top" headers="wq256 wq257">first</td>
|
||
|
<td align="center" valign="top" headers="wq256 wq258">first</td>
|
||
|
<td align="center" valign="top" headers="wq256 wq259">first</td>
|
||
|
<td align="center" valign="top" headers="wq256 wq260">see below</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<ul>
|
||
|
<li>Otherwise, the resulting CCSID is determined by the following tables:</li></ul>
|
||
|
<a name="wq261"></a>
|
||
|
<table id="wq261" width="100%" summary="" border="1" frame="border" rules="all">
|
||
|
<caption>Table 21. Selecting the CCSID of the Intermediate Result</caption>
|
||
|
<thead valign="bottom">
|
||
|
<tr>
|
||
|
<th id="wq262" width="28%" rowspan="2" align="center" valign="bottom">First Operand</th>
|
||
|
<th id="wq263" colspan="5" align="center" valign="bottom">Second
|
||
|
Operand</th>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<th id="wq264" width="14%" align="center" valign="bottom">Column Value</th>
|
||
|
<th id="wq265" width="14%" align="center" valign="bottom">Derived Value</th>
|
||
|
<th id="wq266" width="14%" align="center" valign="bottom">Constant</th>
|
||
|
<th id="wq267" width="14%" align="center" valign="bottom">Special Register</th>
|
||
|
<th id="wq268" width="13%" align="center" valign="bottom">Variable</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody valign="top">
|
||
|
<tr>
|
||
|
<td align="left" valign="top" headers="wq262">
|
||
|
<div class="lines">Column Value<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq264">
|
||
|
<div class="lines">first<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq265">
|
||
|
<div class="lines">first<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq266">
|
||
|
<div class="lines">first<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq267">
|
||
|
<div class="lines">first<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq268">
|
||
|
<div class="lines">first<br />
|
||
|
</div></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="top" headers="wq262">
|
||
|
<div class="lines">Derived Value<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq264">
|
||
|
<div class="lines">second<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq265">
|
||
|
<div class="lines">first<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq266">
|
||
|
<div class="lines">first<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq267">
|
||
|
<div class="lines">first<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq268">
|
||
|
<div class="lines">first<br />
|
||
|
</div></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="top" headers="wq262">
|
||
|
<div class="lines">Constant<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq264">
|
||
|
<div class="lines">second<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq265">
|
||
|
<div class="lines">second<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq266">
|
||
|
<div class="lines">first<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq267">
|
||
|
<div class="lines">first<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq268">
|
||
|
<div class="lines">first<br />
|
||
|
</div></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="top" headers="wq262">
|
||
|
<div class="lines">Special Register<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq264">
|
||
|
<div class="lines">second<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq265">
|
||
|
<div class="lines">second<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq266">
|
||
|
<div class="lines">first<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq267">
|
||
|
<div class="lines">first<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq268">
|
||
|
<div class="lines">first<br />
|
||
|
</div></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" valign="top" headers="wq262">
|
||
|
<div class="lines">Variable<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq264">
|
||
|
<div class="lines">second<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq265">
|
||
|
<div class="lines">second<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq266">
|
||
|
<div class="lines">second<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq267">
|
||
|
<div class="lines">second<br />
|
||
|
</div></td>
|
||
|
<td align="center" valign="top" headers="wq263 wq268">
|
||
|
<div class="lines">first<br />
|
||
|
</div></td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<p>A variable containing data in a foreign encoding scheme is effectively
|
||
|
converted to the native encoding scheme before it is used in any operation.
|
||
|
The above rules are based on the assumption that this conversion has already
|
||
|
occurred.</p>
|
||
|
<p>Note that an intermediate result is considered to be a derived value operand.
|
||
|
For example, assume COLA, COLB, and COLC are columns with CCSIDs 37, 278,
|
||
|
and 500, respectively. The result CCSID of COLA CONCAT COLB CONCAT COLC is
|
||
|
determined as follows: </p>
|
||
|
<ol type="1">
|
||
|
<li id="jstep1">
|
||
|
<a name="jstep1"></a>The result CCSID of COLA CONCAT COLB is first determined to
|
||
|
be 37 because both operands are columns, so the CCSID of the first operand
|
||
|
is chosen.</li>
|
||
|
<li>The result CCSID of "intermediate result" CONCAT COLC is determined
|
||
|
to be 500, because the first operand is a derived value and the second operand
|
||
|
is a column, so the CCSID of the second operand is chosen.</li></ol>
|
||
|
<p>An operand of concatenation, or the result expression of the CASE expression,
|
||
|
or the operands of the IN predicate, or the selected argument of the MAX,
|
||
|
MIN, VALUE, COALESCE, IFNULL, or CONCAT scalar function is converted, if necessary,
|
||
|
to the coded character set of the result string. Each string of an operand
|
||
|
of UNION, UNION ALL, EXCEPT, or INTERSECT is converted, if necessary, to the
|
||
|
coded character set of the result column. Character conversion is necessary
|
||
|
only if all of the following are true: </p>
|
||
|
<ul>
|
||
|
<li>The CCSIDs are different.</li>
|
||
|
<li>Neither CCSID is 65535.</li>
|
||
|
<li>The string is neither null nor empty.</li>
|
||
|
<li>The CCSID Conversion Selection Table (<a href="rbafzmstccseta.htm#conccsid">Coded character sets and CCSIDs</a>) indicates
|
||
|
that conversion is necessary.</li></ul>
|
||
|
<p>An error occurs if a character of a string cannot be converted or if the
|
||
|
CCSID Conversion Selection Table is used but does not contain any information
|
||
|
about the CCSID pair. A warning occurs if a character of a string is converted
|
||
|
to the substitution character.</p>
|
||
|
<hr /><div class="fnnum"><a id="wq253" name="wq253" href="rbafzmstuuall.htm#wq252">25</a>.</div>
|
||
|
<div class="fntext">If either operand is
|
||
|
a CLOB or DBCLOB, the resulting CCSID is the job default CCSID.</div>
|
||
|
<br />
|
||
|
<hr /><br />
|
||
|
[ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzmstopcomb.htm">Previous Page</a> | <a href="rbafzmstch2cons.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>
|