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

69 lines
4.1 KiB
HTML
Raw 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="Usage notes on subqueries" />
<meta name="abstract" content="When using subqueries, you should be aware of these usage notes." />
<meta name="description" content="When using subqueries, you should be aware of these usage notes." />
<meta name="DC.subject" content="subquery, notes on using" />
<meta name="keywords" content="subquery, notes on using" />
<meta name="DC.Relation" scheme="URI" content="rbafysubq.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="rbafysubquerynotes" />
<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>Usage notes on subqueries</title>
</head>
<body id="rbafysubquerynotes"><a name="rbafysubquerynotes"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Usage notes on subqueries</h1>
<div><p>When using subqueries, you should be aware of these usage notes.</p>
<div class="section"> <ol><li>When nesting SELECT statements, you can use as many as you need to satisfy
your requirements (1 to 255 subqueries), although performance is slower for
each additional subquery.</li>
<li><img src="./delta.gif" alt="Start of change" />For predicates using the keywords ALL, ANY, SOME, or
EXISTS, the number of rows returned from the subquery can vary from zero to
many. For all other subqueries, the number of rows returned must be zero or
one.<img src="./deltaend.gif" alt="End of change" /></li>
<li><img src="./delta.gif" alt="Start of change" />For the following predicates, a row fullselect can be
used for the subquery. This means that the subquery can return more than one
value for a row.<ul><li>Basic predicate with equal or not equal comparisons</li>
<li>Quantified predicates using =ANY, =ALL, and =SOME</li>
<li>IN and NOT IN predicates</li>
</ul>
If a row fullselect is used:<ul><li>The select list must not contain SELECT *. Explicit values must be specified.</li>
<li>A row fullselect must be compared to a row expression. A row expression
is a list of values enclosed in parentheses. There must be the same number
of values returned from the subquery as there are in the row expression.</li>
<li>The row expression for an IN or NOT IN predicate cannot contain an untyped
parameter marker. Use CAST to supply a result data type for these parameter
markers.</li>
<li>The subquery cannot contain UNION, EXCEPT, or INTERSECT or a
correlated reference.</li>
</ul>
<img src="./deltaend.gif" alt="End of change" /></li>
<li><img src="./delta.gif" alt="Start of change" />A subquery cannot include the ORDER BY, FOR READ ONLY,
FETCH FIRST <em>n</em> ROWS, UPDATE, or OPTIMIZE clauses.<img src="./deltaend.gif" alt="End of change" /></li>
</ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafysubq.htm" title="Subqueries can help you to further refine your search conditions.">Subqueries in SELECT statements</a></div>
</div>
</div>
</body>
</html>