59 lines
3.4 KiB
HTML
59 lines
3.4 KiB
HTML
<?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="Host variables in Structured Query Language for Java" />
|
|
<meta name="abstract" content="Arguments to embedded SQL statements are passed through host variables. Host variables are variables of the host language, and they can appear in SQL statements." />
|
|
<meta name="description" content="Arguments to embedded SQL statements are passed through host variables. Host variables are variables of the host language, and they can appear in SQL statements." />
|
|
<meta name="DC.Relation" scheme="URI" content="sqljembd.htm" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
|
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
|
|
<meta name="DC.Format" content="XHTML" />
|
|
<meta name="DC.Identifier" content="sqljhost" />
|
|
<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>Host variables in Structured Query Language for Java</title>
|
|
</head>
|
|
<body id="sqljhost"><a name="sqljhost"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Host variables in Structured Query Language for Java</h1>
|
|
<div><p>Arguments to embedded SQL statements are passed through host variables.
|
|
Host variables are variables of the host language, and they can appear in
|
|
SQL statements.</p>
|
|
<p>Host variables have up to three parts:</p>
|
|
<ul><li>A colon (:) prefix.</li>
|
|
<li>A Java™ host
|
|
variable that is a Java identifier for a parameter, variable,
|
|
or field.</li>
|
|
<li>An optional parameter mode identifier. <dl><dt class="dlterm">This mode identifier can be one of the following:</dt>
|
|
<dd>IN, OUT, or INOUT.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<p>The evaluation of a Java identifier does not have side effects
|
|
in a Java program,
|
|
so it may appear multiple times in the Java code generated to replace an SQLJ clause.</p>
|
|
<p>The following query contains the host variable, <samp class="codeph">:x</samp>. This
|
|
host variable is the Java variable, field, or parameter <samp class="codeph">x</samp> that
|
|
is visible in the scope containing the query.</p>
|
|
<blockquote><pre>SELECT COL1, COL2 FROM TABLE1 WHERE :x > COL3</pre>
|
|
</blockquote>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="sqljembd.htm" title="Static SQL statements in SQLJ are in SQLJ clauses. SQLJ clauses begin with #sql and end with a semicolon (;) character.">Embed SQL statements in your Java application</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |