ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzajp_5.4.0.1/rzajpnumrule.htm

75 lines
5.3 KiB
HTML
Raw Permalink 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 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="reference" />
<meta name="DC.Title" content="Rules for numeric assignment of host variables in SQL statements" />
<meta name="abstract" content="Rules regarding numeric assignment are as follows." />
<meta name="description" content="Rules regarding numeric assignment are as follows." />
<meta name="DC.subject" content="numeric assignment rule, host variable, using, rule, assignment rule, host variable, using, host variable, SQL statement, use in, rule for numeric assignment, numeric assignment, halfword binary integer (SMALLINT), fullword binary integer (INTEGER), double fullword binary integer (BIGINT), floating-point number" />
<meta name="keywords" content="numeric assignment rule, host variable, using, rule, assignment rule, host variable, using, host variable, SQL statement, use in, rule for numeric assignment, numeric assignment, halfword binary integer (SMALLINT), fullword binary integer (INTEGER), double fullword binary integer (BIGINT), floating-point number" />
<meta name="DC.Relation" scheme="URI" content="rzajpasnrule.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="rzajpnumrule" />
<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>Rules for numeric assignment of host variables in SQL statements</title>
</head>
<body id="rzajpnumrule"><a name="rzajpnumrule"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Rules for numeric assignment of host variables in SQL statements</h1>
<div><p>Rules regarding numeric assignment are as follows.</p>
<div class="section"><ul><li><strong>The whole part of a number may be altered when converting it to floating-point</strong>.
A single-precision floating-point field can only contain seven decimal digits.
Any whole part of a number that contains more than seven digits is altered
due to rounding. A double-precision floating point field can only contain
16 decimal digits. Any whole part of a number that contains more than 16 digits
is altered due to rounding.</li>
<li><strong>The whole part of a number is never truncated.</strong> If necessary, the
fractional part of a number is truncated. If the number, as converted, does
not fit into the target host variable or column, a negative SQLCODE is returned.</li>
<li>Whenever a <strong>decimal, numeric, or integer number</strong> is assigned to a
decimal, numeric, or integer column or host variable, the number is converted,
if necessary, to the precision and scale of the target. The necessary number
of leading zeros is added or deleted; in the fractional part of the number,
the necessary number of trailing zeros is added, or the necessary number of
trailing digits is eliminated.</li>
<li>When an <strong>integer or floating-point number</strong> is assigned to a decimal
or numeric column or host variable, the number is first converted to a temporary
decimal or numeric number and then converted, if necessary, to the precision
and scale of the target. <ul><li>When a <strong>halfword binary integer</strong> (SMALLINT) with 0 scale is converted
to decimal or numeric, the temporary result has a precision of 5 and a scale
of 0.</li>
<li>When a <strong>fullword binary integer</strong> (INTEGER) is converted to decimal
or numeric, the temporary result has a precision of 11 and a scale of 0.</li>
<li>When a <strong>double fullword binary integer</strong> (BIGINT) is converted to
a decimal or numeric, the temporary result has a precision of 19 and a scale
of 0.</li>
<li>When a <strong>floating-point number</strong> is converted to decimal or numeric,
the temporary result has a precision of 31 and the maximum scale that allows
the whole part of the number to be represented without loss of either significance
or accuracy.</li>
</ul>
</li>
</ul>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajpasnrule.htm" title="SQL values are assigned to host variables during the running of FETCH, SELECT INTO, SET, and VALUES INTO statements. SQL values are assigned from host variables during the running of INSERT, UPDATE, and CALL statements.">Assignment rules for host variables in SQL statements</a></div>
</div>
</div>
</body>
</html>