ibm-information-center/dist/eclipse/plugins/i5OS.ic.sqlp_5.4.0.1/rbafyspeciallike.htm

77 lines
4.6 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="Special considerations for LIKE" />
<meta name="abstract" content="Here are some special considerations for using LIKE." />
<meta name="description" content="Here are some special considerations for using LIKE." />
<meta name="DC.subject" content="keyword, LIKE, considerations, LIKE keyword, statements, SELECT, LIKE, considerations, SELECT statement" />
<meta name="keywords" content="keyword, LIKE, considerations, LIKE keyword, statements, SELECT, LIKE, considerations, SELECT statement" />
<meta name="DC.Relation" scheme="URI" content="rbafycomsrch.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafycomsrch.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="rbafyspeciallike" />
<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>Special considerations for LIKE</title>
</head>
<body id="rbafyspeciallike"><a name="rbafyspeciallike"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Special considerations for LIKE</h1>
<div><p>Here are some special considerations for using LIKE.</p>
<div class="section"> <ul><li>When host variables are used in place of string constants in a search
pattern, you should consider using varying length host variables. This allows
you to: <ul><li>Assign previously used string constants to host variables without any
change.</li>
<li>Obtain the same selection criteria and results as if a string constant
was used.</li>
</ul>
</li>
<li>When fixed-length host variables are used in place of string constants
in a search pattern, you should ensure that the value specified in the host
variable matches the pattern previously used by the string constants. All
characters in a host variable that are not assigned a value are initialized
with a blank. <p>For example, if you did a search using the string pattern
'ABC%' in a <em>varying length</em> host variable, these are some
of the values that can be returned: </p>
<pre>'ABCD ' 'ABCDE' 'ABCxxx' 'ABC '</pre>
<p>However,
if you did a search using the search pattern 'ABC%' contained in a host variable
with a <em>fixed length</em> of 10, these are some the values that can be returned
assuming the column has a length of 12: </p>
<pre>'ABCDE ' 'ABCD ' 'ABCxxx ' 'ABC '</pre>
<p>Note
that all returned values start with 'ABC' and end with at least six blanks.
This is because the last six characters in the host variable were not assigned
a specific value so blanks were used.</p>
<p>If you wanted to do a search using
a fixed-length host variable where the last 7 characters can be anything,
search for 'ABC%%%%%%%'. These are some values that can be returned: </p>
<pre>'ABCDEFGHIJ' 'ABCXXXXXXX' 'ABCDE' 'ABCDD'</pre>
</li>
</ul>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafycomsrch.htm" title="In addition to the basic comparison predicates (=, &gt;, &lt;, and so on), a search condition can contain any of the predicates BETWEEN, IN, EXISTS, IS NULL, and LIKE.">Define complex search conditions</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="rbafycomsrch.htm" title="In addition to the basic comparison predicates (=, &gt;, &lt;, and so on), a search condition can contain any of the predicates BETWEEN, IN, EXISTS, IS NULL, and LIKE.">Define complex search conditions</a></div>
</div>
</div>
</body>
</html>