106 lines
5.7 KiB
HTML
106 lines
5.7 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="VALUES statement, VALUES, SQL statements,
|
||
|
in VALUES statement, expression, NULL, row-fullselect" />
|
||
|
<title>VALUES</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="valuestmt"></a>
|
||
|
<h2 id="valuestmt"><a href="rbafzmst02.htm#ToC_1384">VALUES</a></h2><a id="idx3295" name="idx3295"></a><a id="idx3296" name="idx3296"></a>
|
||
|
<p>The VALUES statement provides a method for invoking a user-defined function
|
||
|
from a trigger. Transition variables can be passed to the user-defined function.</p>
|
||
|
<a name="wq1830"></a>
|
||
|
<h3 id="wq1830"><a href="rbafzmst02.htm#ToC_1385">Invocation</a></h3>
|
||
|
<p>This statement can only be used in the triggered action of a CREATE TRIGGER
|
||
|
statement.</p>
|
||
|
<a name="wq1831"></a>
|
||
|
<h3 id="wq1831"><a href="rbafzmst02.htm#ToC_1386">Authorization</a></h3>
|
||
|
<p>If a <span class="italic">row-fullselect</span> is specified, see <a href="rbafzmstsubsel.htm#subsel">Queries</a> for an explanation of the authorization required for each
|
||
|
subselect.</p>
|
||
|
<a name="wq1832"></a>
|
||
|
<h3 id="wq1832"><a href="rbafzmst02.htm#ToC_1387">Syntax</a></h3>
|
||
|
<a href="rbafzmstvaluestmt.htm#synsvalues"><img src="c.gif" alt="Click to skip syntax diagram" /></a>
|
||
|
<p>
|
||
|
</p>
|
||
|
<pre class="cgraphic"><span><img src="c.gif" alt="Read syntax diagram" longdesc="rbafzmstsyn401.htm"
|
||
|
border="0" /></span><a href="#skipsyn-400"><img src="c.gif" alt="Skip visual syntax diagram"
|
||
|
border="0" /></a>>>-VALUES--+-+-<span class="italic">expression</span>-+---------------+--------------------><
|
||
|
| '-NULL-------' |
|
||
|
| .-,--------------. |
|
||
|
| V | |
|
||
|
'-(--+---+-<span class="italic">expression</span>-+-+-+--)-'
|
||
|
| '-NULL-------' |
|
||
|
'-<span><span class="italic">row-fullselect</span></span>-----'
|
||
|
|
||
|
</pre>
|
||
|
<a name="skipsyn-400" id="skipsyn-400"></a>
|
||
|
<a name="synsvalues"></a>
|
||
|
<h3 id="synsvalues"><a href="rbafzmst02.htm#ToC_1388">Description</a></h3>
|
||
|
<dl class="parml">
|
||
|
<dt class="bold">VALUES </dt>
|
||
|
<dd>Introduces a single row consisting of one of more columns.
|
||
|
<dl class="parml">
|
||
|
<dt class="bold"><var class="pv">expression</var> </dt><a id="idx3297" name="idx3297"></a>
|
||
|
<dd>Any expression of the type described in <a href="rbafzmstch2expr.htm#ch2expr">Expressions</a>.
|
||
|
</dd>
|
||
|
<dt class="bold">NULL</dt><a id="idx3298" name="idx3298"></a>
|
||
|
<dd>Specifies the null value.
|
||
|
</dd>
|
||
|
<dt class="bold"><var class="pv">row-fullselect</var></dt><a id="idx3299" name="idx3299"></a>
|
||
|
<dd>A fullselect that returns a single result row. If the result of the
|
||
|
fullselect is no rows, then null values are returned. An error is returned
|
||
|
if there is more than one row in the result.
|
||
|
</dd>
|
||
|
</dl>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<a name="wq1833"></a>
|
||
|
<h3 id="wq1833"><a href="rbafzmst02.htm#ToC_1389">Notes</a></h3>
|
||
|
<p><span class="bold">Effects of the statement:</span> The statement is evaluated,
|
||
|
but the resulting values are discarded and are not assigned to any output
|
||
|
variables. If an error is returned, the database manager stops executing the trigger and
|
||
|
rolls back any triggered actions that were performed as well as the statement
|
||
|
that caused the triggered action (unless the trigger is running under isolation
|
||
|
level *NONE).</p>
|
||
|
<a name="wq1834"></a>
|
||
|
<h3 id="wq1834"><a href="rbafzmst02.htm#ToC_1390">Examples</a></h3>
|
||
|
<p>Create an after trigger EMPISRT1 that invokes user-defined function NEWEMP
|
||
|
when the trigger is activated. An insert operation on table EMP activates
|
||
|
the trigger. Pass transition variables for the new employee number, last name,
|
||
|
and first name to the user-defined function.</p>
|
||
|
<pre class="xmp"> <span class="bold">CREATE TRIGGER</span> EMPISRT1
|
||
|
<span class="bold">AFTER INSERT ON</span> EMPLOYEE
|
||
|
<span class="bold">REFERENCING NEW AS</span> N
|
||
|
<span class="bold">FOR EACH ROW</span>
|
||
|
<span class="bold">MODE DB2SQL</span>
|
||
|
<span class="bold">BEGIN ATOMIC</span>
|
||
|
<span class="bold">VALUES(</span> NEWEMP(N.EMPNO, N.LASTNAME, N.FIRSTNAME)<span class="bold">);</span>
|
||
|
<span class="bold">END</span> </pre>
|
||
|
<hr /><br />
|
||
|
[ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzmstupdt.htm">Previous Page</a> | <a href="rbafzmstvalinto.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>
|