70 lines
4.3 KiB
HTML
70 lines
4.3 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 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 parameters, SQLvariables" />
|
|
<title>References to SQL parameters and SQL variables</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="refsqlv"></a>
|
|
<h2 id="refsqlv"><a href="rbafzmst02.htm#ToC_1406">References to SQL parameters and SQL variables</a></h2><a id="idx3322" name="idx3322"></a><a id="idx3323" name="idx3323"></a>
|
|
<p>SQL parameters and SQL variables can be referenced anywhere in an SQL procedure
|
|
statement where an expression or variable can be specified. Host variables
|
|
cannot be specified in SQL functions, SQL procedures, or SQL triggers. SQL
|
|
parameters can be referenced anywhere in the routine and can be qualified
|
|
with the routine name. SQL variables can be referenced anywhere in the compound
|
|
statement in which they are declared and can be qualified with the label name
|
|
specified at the beginning of the compound statement.</p>
|
|
<p>All SQL parameters and SQL variables are considered nullable except SQL
|
|
variables that are explicitly declared as NOT NULL. The name of an SQL parameter
|
|
or SQL variable in an SQL routine can be the same as the name of a column
|
|
in a table or view referenced in the routine. In this case, the name should
|
|
be explicitly qualified to indicate whether it is a column, SQL variable,
|
|
or SQL parameter.</p>
|
|
<p>If the name is not qualified, the following rules describe whether the
|
|
name refers to the column or to the SQL variable or SQL parameter:</p>
|
|
<ul>
|
|
<li>If the tables and views specified in an SQL routine body exist at the
|
|
time the routine is created, the name will first be checked as a column name.
|
|
If not found as a column, it will then be checked as an SQL variable name
|
|
in the compound statement, and then checked as an SQL parameter name.</li>
|
|
<li>If the referenced tables or views do not exist at the time the routine
|
|
is created, the name will first be checked as an SQL variable name in the
|
|
compound statement and then as an SQL parameter name. If not found, it will
|
|
be assumed to be a column.</li></ul>
|
|
<p>The name of an SQL parameter or SQL variable in an SQL routine can be the
|
|
same as the name of an identifier used in certain SQL statements. If the name
|
|
is not qualified, the following rules describe whether the name refers to
|
|
the identifier or to the SQL parameter or SQL variable:</p>
|
|
<ul>
|
|
<li>In the SET PATH and SET SCHEMA statements, the name is checked as an SQL
|
|
parameter name or SQL variable name. If not found as an SQL variable or SQL
|
|
parameter name, it will then be used as an identifier.</li>
|
|
<li>In the CONNECT, DISCONNECT, RELEASE, and SET CONNECTION statements,
|
|
the name is used as an identifier.</li></ul>
|
|
<hr /><br />
|
|
[ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzmstsqlcontstmts.htm">Previous Page</a> | <a href="rbafzmstsqlprocstmt.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>
|