ibm-information-center/dist/eclipse/plugins/i5OS.ic.nls_5.4.0.1/rbagssqlanddbchars.htm

109 lines
6.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="concept" />
<meta name="DC.Title" content="SQL and DBCS" />
<meta name="abstract" content="The basic symbols of keywords and operators in the SQL language are single-byte characters that are part of all character sets supported by the IBM relational database products. Characters of the language are classified as letters, digits, or special characters." />
<meta name="description" content="The basic symbols of keywords and operators in the SQL language are single-byte characters that are part of all character sets supported by the IBM relational database products. Characters of the language are classified as letters, digits, or special characters." />
<meta name="DC.Relation" scheme="URI" content="rbagsdesigndbcsapps.htm" />
<meta name="DC.Relation" scheme="URI" content="rbagssqlgraphstrngcons.htm" />
<meta name="DC.Relation" scheme="URI" content="rbagssqlasgncompdbcs.htm" />
<meta name="DC.Relation" scheme="URI" content="rbagssqlconversrules.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="rbagssqlanddbchars" />
<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>SQL and DBCS</title>
</head>
<body id="rbagssqlanddbchars"><a name="rbagssqlanddbchars"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">SQL and DBCS</h1>
<div><p>The basic symbols of keywords and operators in the SQL language
are single-byte characters that are part of all character sets supported by
the IBM<sup>®</sup> relational
database products. Characters of the language are classified as letters, digits,
or special characters.</p>
<div class="section"><h4 class="sectiontitle">SQL host identifiers and double-byte characters</h4><p>A
host-identifier is a name declared in the host program. The rules for forming
a host-identifier are the rules of the host language, except that DBCS characters
cannot be used.</p>
</div>
<div class="section"><h4 class="sectiontitle">SQL character subtypes and double-byte characters</h4><p>Each character string is further defined as follows:</p>
<ul><li><span class="uicontrol">Bit data:</span> <p>Data that is not associated with a
coded character set and is never converted. The CCSID for bit data is 65535.</p>
</li>
<li><span class="uicontrol">SBCS data:</span> <p>Data in which every character is
represented by a single byte. Each SBCS data character string has an associated
CCSID. If necessary, an SBCS data character string is converted before it
is used in an operation with a character string that has a different CCSID.</p>
</li>
<li><span class="uicontrol">Mixed data:</span> <p>Data that contains a mixture of
characters from a single-byte character set (SBCS) and a double-byte character
set (DBCS). Each mixed data character string has an associated CCSID. If necessary,
a mixed data character string is converted before an operation
with a character string that has a different CCSID. If mixed data contains
a DBCS character, it cannot be converted to SBCS data.</p>
</li>
</ul>
<p>The database manager does not recognize subclasses of double-byte
characters, and it does not assign any specific meaning to particular double-byte
codes. However, if you choose to use mixed data, then two single-byte EBCDIC
codes are given special meanings:</p>
<ul><li>X'0E', the shift-out character, is used to mark the beginning of a sequence
of double-byte codes.</li>
<li>X'0F', the shift-in character, is used to mark the end of a sequence of
double-byte codes.</li>
</ul>
<p>In order for the database manager to recognize double-byte characters
in a mixed data character string, the following condition must be met:</p>
<ul><li>Within the string, the double-byte characters must be enclosed between
paired shift-out and shift-in characters. <p>The pairing is detected as the
string is read from left to right. The code X'0E' is recognized as a shift
out character if X'0F' occurs later; otherwise, it is invalid. The first X'0F'
following the X'0E' that is on a double-byte boundary is the paired shift-in
character. Any X'0F' that is not on a double-byte boundary is not recognized.</p>
<p>There
must be an even number of bytes between the paired characters, and each pair
of bytes is considered to be a double-byte character. There can be more than
one set of paired shift-out and shift-in characters in the string.</p>
</li>
</ul>
<p>The length of a mixed data character string is its total number of
bytes, counting two bytes for each double-byte character and one byte for
each shift-out or shift-in character.</p>
<p>When the job CCSID indicates that
DBCS is allowed, CREATE TABLE will create character columns as DBCS-Open fields,
unless FOR BIT DATA, FOR SBCS DATA, or an SBCS CCSID is specified. The SQL
user will see these as character fields, but the system database support will
see them as DBCS-Open fields.</p>
</div>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="rbagssqlgraphstrngcons.htm">SQL graphic strings</a></strong><br />
A graphic string is a sequence of double-byte characters that do not include shift-out or shift-in characters.</li>
<li class="ulchildlink"><strong><a href="rbagssqlasgncompdbcs.htm">SQL assignments and comparisons</a></strong><br />
The basic operations of SQL are assignment and comparison.</li>
<li class="ulchildlink"><strong><a href="rbagssqlconversrules.htm">SQL conversion rules</a></strong><br />
When two strings are compared, one of the strings is first converted, if necessary, to the coded character set of the other string.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbagsdesigndbcsapps.htm" title="Design your application programs for processing double-byte data in the same way you design application programs for processing alphanumeric data.">Develop applications that process DBCS data</a></div>
</div>
</div>
</body>
</html>