ibm-information-center/dist/eclipse/plugins/i5OS.ic.db2_5.4.0.1/rbafzmstsqcomm.htm

77 lines
4.3 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 xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="dc.language" scheme="rfc1766" 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. -->
<meta name="dc.date" scheme="iso8601" content="2005-09-19" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<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="keywords" content="SQL, comment" />
<title>SQL comments</title>
<link rel="stylesheet" type="text/css" href="ibmidwb.css" />
<link rel="stylesheet" type="text/css" href="ic.css" />
</head>
<body>
<a id="Top_Of_Page" name="Top_Of_Page"></a><!-- Java sync-link -->
<script language = "Javascript" src = "../rzahg/synch.js" type="text/javascript"></script>
<a name="sqcomm"></a>
<h2 id="sqcomm"><a href="rbafzmst02.htm#ToC_733">SQL comments</a></h2><a id="idx1273" name="idx1273"></a>
<p>Static SQL statements can include host language or SQL comments. Dynamic
SQL statements can include SQL comments. There are two types of SQL comments:</p>
<dl>
<dt class="bold">simple comments</dt>
<dd>Simple comments are introduced by two consecutive hyphens.
</dd>
<dt class="bold">bracketed comments</dt>
<dd>Bracketed comments are introduced by /* and end with */.
</dd>
</dl>
<p>These rules apply to the use of simple comments: </p>
<ul>
<li>The two hyphens must be on the same line and must not be separated by
a space.</li>
<li>Simple comments can be started wherever a space is valid (except within
a delimiter token or between 'EXEC' and 'SQL').</li>
<li>Simple comments cannot be continued to the next line.</li>
<li>In COBOL, the hyphens must be preceded by a space.</li></ul>
<p>These rules apply to the use of bracketed comments: </p>
<ul>
<li>The /* must be on the same line and not separated by a space.</li>
<li>The */ must be on the same line and not separated by a space.</li>
<li>Bracketed comments can be started wherever a space is valid (except within
a delimiter token or between 'EXEC' and 'SQL').</li>
<li>Bracketed comments can be continued to the next line.</li>
<li>Bracketed comments can be nested within other bracketed comments.</li></ul>
<p><span class="italic">Example 1</span>: This example shows how to include simple
comments in a statement: </p>
<pre class="xmp"> <span class="bold">CREATE VIEW</span> PRJ_MAXPER -- PROJECTS WITH MOST SUPPORT PERSONNEL
<span class="bold">AS SELECT</span> PROJNO, PROJNAME -- NUMBER AND NAME OF PROJECT
<span class="bold">FROM</span> PROJECT
<span class="bold">WHERE</span> DEPTNO = 'E21' -- SYSTEMS SUPPORT DEPT CODE
<span class="bold">AND</span> PRSTAFF > 1</pre>
<p><span class="italic">Example 2</span>: This example shows how to include bracketed
comments in a statement: </p>
<pre class="xmp"> <span class="bold">CREATE VIEW</span> PRJ_MAXPER /* PROJECTS WITH MOST SUPPORT
PERSONNEL */
<span class="bold">AS SELECT</span> PROJNO, PROJNAME /* NUMBER AND NAME OF PROJECT */
<span class="bold">FROM</span> PROJECT
<span class="bold">WHERE</span> DEPTNO = 'E21' /* SYSTEMS SUPPORT DEPT CODE */
<span class="bold">AND</span> PRSTAFF > 1</pre>
<hr /><br />
[ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzmstcksql.htm">Previous Page</a> | <a href="rbafzallocatedescr.htm">Next Page</a> | <a href="rbafzmst02.htm#wq1">Contents</a> |
<a href="rbafzmstindex.htm#index">Index</a> ]
<a id="Bot_Of_Page" name="Bot_Of_Page"></a>
</body>
</html>