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

89 lines
6.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 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="Embed SQL statements in C and C++ applications that use SQL" />
<meta name="abstract" content="SQL statements can be coded in a C or C++ program wherever executable statements can appear." />
<meta name="description" content="SQL statements can be coded in a C or C++ program wherever executable statements can appear." />
<meta name="DC.subject" content="embedded SQL, C, C++" />
<meta name="keywords" content="embedded SQL, C, C++" />
<meta name="DC.Relation" scheme="URI" content="rzajpc.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpcommentsc.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpcontinuationc.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpincludecodec.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpmarginsc.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpcnamco.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpnullsc.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpstmtlabelsc.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajppreprocessorc.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajptrigraphsc.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpwheneverc.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="rzajpembedsqlc" />
<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>Embed SQL statements in C and C++ applications that use
SQL</title>
</head>
<body id="rzajpembedsqlc"><a name="rzajpembedsqlc"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Embed SQL statements in C and C++ applications that use
SQL</h1>
<div><p>SQL statements can be coded in a C or C++ program wherever executable
statements can appear.</p>
<p>Each SQL statement must begin with EXEC SQL and end with a semicolon (;).
The EXEC SQL keywords must be on one line. The remaining part of the SQL statement
can be on more than one line.</p>
<p><em>Example</em>: An UPDATE statement coded in a C or C++ program might be
coded in the following way: </p>
<pre> EXEC SQL
<strong>UPDATE</strong> DEPARTMENT
<strong>SET</strong> MGRNO = :MGR_NUM
<strong>WHERE</strong> DEPTNO = :INT_DEPT ;</pre>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="rzajpcommentsc.htm">Comments in C and C++ applications that use SQL</a></strong><br />
In addition to using SQL comments (--), you can include C comments (/*...*/) within embedded SQL statements whenever a blank is allowed, except between the keywords EXEC and SQL.</li>
<li class="ulchildlink"><strong><a href="rzajpcontinuationc.htm">Continuation for SQL statements in C and C++ applications that use SQL</a></strong><br />
SQL statements can be contained in one or more lines.</li>
<li class="ulchildlink"><strong><a href="rzajpincludecodec.htm">Include code in C and C++ applications that use SQL</a></strong><br />
You can include SQL statements, C, or C++ statements by embedding the following SQL statement in the source code.</li>
<li class="ulchildlink"><strong><a href="rzajpmarginsc.htm">Margins in C and C++ applications that use SQL</a></strong><br />
You must code SQL statements within the margins that are specified
by the MARGINS parameter on the <span class="cmdname">CRTSQLCI</span> or <span class="cmdname">CRTSQLCPPI</span> command.</li>
<li class="ulchildlink"><strong><a href="rzajpcnamco.htm">Names in C and C++ applications that use SQL</a></strong><br />
You can use any valid C or C++ variable name for a host variable. It is subject to the following restrictions:</li>
<li class="ulchildlink"><strong><a href="rzajpnullsc.htm">NULLs and NULs in C and C++ applications that use SQL</a></strong><br />
C, C++, and SQL use the word null, but for different meanings.</li>
<li class="ulchildlink"><strong><a href="rzajpstmtlabelsc.htm">Statement labels in C and C++ applications that use SQL</a></strong><br />
Executable SQL statements can be preceded with a label.</li>
<li class="ulchildlink"><strong><a href="rzajppreprocessorc.htm">Preprocessor sequence for C and C++ applications that use SQL</a></strong><br />
You must run the SQL preprocessor before the C or C++ preprocessor. You cannot use C or C++ preprocessor directives within SQL statements.</li>
<li class="ulchildlink"><strong><a href="rzajptrigraphsc.htm">Trigraphs in C and C++ applications that use SQL</a></strong><br />
Some characters from the C and C++ character set are not available
on all keyboards. You can enter these characters into a C or C++ source program
by using a sequence of three characters that is called a <em>trigraph</em>.</li>
<li class="ulchildlink"><strong><a href="rzajpwheneverc.htm">WHENEVER Statement in C and C++ applications that use SQL</a></strong><br />
The target for the GOTO clause in an SQL WHENEVER statement must be within the scope of any SQL statements affected by the WHENEVER statement.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajpc.htm" title="This topic describes the unique application and coding requirements for embedding SQL statements in a C or C++ program.">Code SQL statements in C and C++ applications</a></div>
</div>
</div>
</body>
</html>