ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzahf_5.4.0.1/rzahfquery.htm

177 lines
11 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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="Additional information" />
<meta name="abstract" content="This topic contains additional information for query for iSeries." />
<meta name="description" content="This topic contains additional information for query for iSeries." />
<meta name="DC.Relation" scheme="URI" content="rzahfreports.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="rzahfquery" />
<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>Additional information</title>
</head>
<body id="rzahfquery"><a name="rzahfquery"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Additional information</h1>
<div><p>This topic contains additional information for query for <span class="keyword">iSeries™</span>.</p>
<div class="section" xml:lang="en-us" id="rzahfquery__changestoquery"><a name="rzahfquery__changestoquery"><!-- --></a><h4 class="sectiontitle">Changes to Query for <span class="keyword">iSeries</span></h4><div class="p">In V5R3, the Query
for <span class="keyword">iSeries</span> manual was not
updated, but numerous functional updates were made to the product. These updates
are summarized here: <ul><li>Support for BINARY, VARBINARY, BLOB, CLOB, DBCLOB, and ROWID data types.</li>
<li>Support for larger numeric and decimal numbers, plus support for large
numeric literals.</li>
<li>The BINARY, VARBINARY, HEX, and LENGTH built-in functions were added.
They are described in this topic.</li>
<li>The VARCHAR function now supports conversion from CLOB to VARCHAR.</li>
<li>The VARGRAPHIC function now supports conversion from CLOB to DBCS graphic,
CLOB to UCS2 graphic, DBCLOB to DBCS graphic, and DBCLOB to UCS2 graphic.</li>
</ul>
</div>
<p>A binary constant is used for comparing a literal with a binary
field (BINARY, VARBINARY, or BLOB). Binary constants are represented with
an X followed by a sequence of characters that starts and ends with a string
delimiter. The characters between the string delimiters must be an even number
of hexadecimal digits. A hexadecimal digit is a digit or any of the letters
A through F (uppercase and lowercase), as shown in the following example: </p>
<div class="p"><pre>Field Test Value
binarycol eq X'12AF'</pre>
</div>
</div>
<div class="section" xml:lang="en-us" id="rzahfquery__binforquery"><a name="rzahfquery__binforquery"><!-- --></a><h4 class="sectiontitle">BINARY built-in function
for Query (added):</h4><div class="p">The BINARY function returns a BINARY representation
of a string of any type. The form is: <pre><span><img src="./c.gif" border="0" alt="Read syntax diagram" longdesc="rzahfquerysyn1.htm" /></span><a href="#d0e49"><img src="./c.gif" border="0" alt="Skip visual syntax diagram" /></a>
>>-BINARY--(--<i>string-expression</i>--+-----------+--)-------------->&lt;
    '-<i>, integer</i>-'    
</pre><a name="d0e49"></a></div>
<p>The result
of the function is a fixed-length binary string. If the first argument can
be null, the result can be null; if the first argument is null, the result
is the null value.</p>
<p>The first argument must be a string-expression
whose value must be a built-in character string, graphic string, binary string,
or row ID data type. </p>
<div class="p">The second argument specifies the length attribute
for the resulting binary string. The value must be between 1 and 32766. If
the second argument is not specified, the following rules apply:<ul><li>If the string-expression is the empty string constant, the length attribute
of the result is 1.</li>
<li>Otherwise, the length attribute of the result is the same as the length
attribute of the first argument, unless the argument is a graphic string.
In this case, the length attribute of the result is twice the length attribute
of the argument.</li>
</ul>
</div>
<p>The actual length is the same as the length attribute of the result.
If the length of the string-expression is less than the length of the result,
the result is padded with hexadecimal zeros up to the length of the result.
If the length of the string-expression is greater than the length attribute
of the result, truncation is performed.</p>
</div>
<div class="section" xml:lang="en-us" id="rzahfquery__varbinaryforquery"><a name="rzahfquery__varbinaryforquery"><!-- --></a><h4 class="sectiontitle">VARBINARY built-in
function for Query (added):</h4><div class="p">The VARBINARY function returns a VARBINARY
representation of a string of any type. The form is:<pre><span><img src="./c.gif" border="0" alt="Read syntax diagram" longdesc="rzahfquerysyn2.htm" /></span><a href="#d0e84"><img src="./c.gif" border="0" alt="Skip visual syntax diagram" /></a>
>>-VARBINARY--(--<i>string-expression</i>--+-----------+--)----------->&lt;
    '-<i>, integer</i>-'    
</pre><a name="d0e84"></a></div>
<p>The result
of the function is VARBINARY. If the first argument can be null, the result
can be null; if the first argument is null, the result is the null value.</p>
<p>The
first argument is a string-expression whose value can be a character string,
graphic string, binary string, or row ID. </p>
<div class="p">The second argument specifies
the length attribute for the resulting binary string. The value must be between
1 and 32740 (32739 if nullable). If the second argument is not specified,
the following rules apply:<ul><li>If the string-expression is the empty string constant, the length attribute
of the result is 1.</li>
<li>Otherwise, the length attribute of the result is the same as the length
attribute of the first argument, unless the argument is a graphic string.
In this case, the length attribute of the result is twice the length attribute
of the argument.</li>
</ul>
</div>
<p>The actual length is the same as the length attribute of the result.
If the length of the string-expression is less than the length of the result,
the result is padded with hexadecimal zeros up to the length of the result.
If the length of the string-expression is greater than the length attribute
of the result, truncation is performed. </p>
</div>
<div class="section" xml:lang="en-us" id="rzahfquery__hexforquery"><a name="rzahfquery__hexforquery"><!-- --></a><h4 class="sectiontitle">HEX built-in function for
Query (added):</h4><div class="p">The HEX function returns a hexadecimal representation
of a value. The form is: <pre><span><img src="./c.gif" border="0" alt="Read syntax diagram" longdesc="rzahfquerysyn3.htm" /></span><a href="#d0e119"><img src="./c.gif" border="0" alt="Skip visual syntax diagram" /></a>
>>-HEX--(--<i>expression</i>--)--------------------------------------->&lt;
</pre><a name="d0e119"></a></div>
<p>The argument can be of any built-in
data type. The result of the function is a character string. If the argument
can be null, the result can be null; if the argument is null, the result is
the null value.</p>
<p>The result is a string of hexadecimal digits. The first
two digits represent the first byte of the argument, the next two digits represent
the second byte of the argument, and so forth. If the argument is a datetime
value, the result is the hexadecimal representation of the internal form of
the argument.</p>
<p>The length attribute of the result is twice the storage
length attribute of the argument. The length attribute of the result cannot
be greater than 32766 for fixed-length results or greater than 32740 for varying-length
results. If the argument is a varying-length string, the result is a varying-length
string. Otherwise, the result is a fixed-length string.</p>
<p>The CCSID of
the string is the default SBCS CCSID at the current server. </p>
</div>
<div class="section" xml:lang="en-us" id="rzahfquery__lengthforquery"><a name="rzahfquery__lengthforquery"><!-- --></a><h4 class="sectiontitle">LENGTH built-in function
for Query (added):</h4><div class="p">The LENGTH function returns the length of a value.
The form is: <pre><span><img src="./c.gif" border="0" alt="Read syntax diagram" longdesc="rzahfquerysyn4.htm" /></span><a href="#d0e145"><img src="./c.gif" border="0" alt="Skip visual syntax diagram" /></a>
>>-LENGTH--(--<i>expression</i>--)------------------------------------>&lt;
</pre><a name="d0e145"></a></div>
<p>The argument must be an expression
that returns a value of any built-in data type. The result of the function
is a large integer. If the argument can be null, the result can be null; if
the argument is null, the result is the null value.</p>
<div class="p">The result is the
length of the argument. The length of strings includes blanks. The length
of a varying-length string is the actual length, not the length attribute.
The length of a graphic string is the number of double-byte characters (the
number of bytes divided by 2). The length of all other values is the number
of bytes used to represent the value:<ul><li>2 for small integer</li>
<li>4 for large integer</li>
<li>8 for big integer</li>
<li>The integral part of <tt>(p/2)+1</tt> for packed decimal numbers with
precision <tt>p</tt></li>
<li><tt>p</tt> for zoned decimal numbers with precision <tt>p</tt></li>
<li>4 for single-precision float</li>
<li>8 for double-precision float</li>
<li>The length of the string for strings</li>
<li>3 for time</li>
<li>4 for date</li>
<li>10 for timestamp</li>
<li>26 for row ID</li>
</ul>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzahfreports.htm" title="Create and run queries using various methods, including SQL, the OPNQRYF command, the i5/OS Create Query API (QQQQRY), ODBC, and Query for iSeries.">Queries and reports</a></div>
</div>
</div>
</body>
</html>