84 lines
5.7 KiB
HTML
84 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 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="reference" />
|
|
<meta name="DC.Title" content="Write UDFs as external functions" />
|
|
<meta name="abstract" content="You can write the executable code of a UDF in a language other than SQL." />
|
|
<meta name="description" content="You can write the executable code of a UDF in a language other than SQL." />
|
|
<meta name="DC.subject" content="UDFs (User-defined functions), writing your own UDF, external" />
|
|
<meta name="keywords" content="UDFs (User-defined functions), writing your own UDF, external" />
|
|
<meta name="DC.Relation" scheme="URI" content="rbafyudf.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="rbafyudfdudf.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="rbafypassarguments.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="rbafytfconsider.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="rbafyudferror.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="rbafyudfthreads.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="rbafyudfparallel.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="rbafysqlpfenced.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="rbafysaveconsider.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="../rzaha/jsqlrout.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="rbafywudfextern" />
|
|
<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>Write UDFs as external functions</title>
|
|
</head>
|
|
<body id="rbafywudfextern"><a name="rbafywudfextern"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Write UDFs as external functions</h1>
|
|
<div><p>You can write the executable code of a UDF in a language other
|
|
than SQL.</p>
|
|
<div class="section"><p>While this method is slightly more cumbersome than an SQL function,
|
|
it provides the flexibility for you to use whatever language is most effective
|
|
for you. The executable code can be contained in either a program or service
|
|
program.</p>
|
|
</div>
|
|
<div class="section"><p>External functions can also be written in Java™. </p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<ul class="ullinks">
|
|
<li class="ulchildlink"><strong><a href="rbafyudfdudf.htm">Register UDFs</a></strong><br />
|
|
A UDF must be registered in the database before the function can be recognized and used by SQL.</li>
|
|
<li class="ulchildlink"><strong><a href="rbafypassarguments.htm">Pass arguments from DB2 to external functions</a></strong><br />
|
|
DB2<sup>®</sup> provides
|
|
storage for all parameters passed to a UDF. Therefore, parameters are passed
|
|
to the external function by address. </li>
|
|
<li class="ulchildlink"><strong><a href="rbafytfconsider.htm">Table function considerations</a></strong><br />
|
|
<span>An external table function is
|
|
a UDF that delivers a table to the SQL in which it was referenced. A table
|
|
function reference is only valid in a FROM clause of a SELECT statement.</span></li>
|
|
<li class="ulchildlink"><strong><a href="rbafyudferror.htm">Error processing for UDFs</a></strong><br />
|
|
When an error is encountered when processing a UDF, the system follows a specified model.</li>
|
|
<li class="ulchildlink"><strong><a href="rbafyudfthreads.htm">Threads considerations</a></strong><br />
|
|
A UDF, defined as FENCED, runs in the same job as the SQL statement that called it. However, the UDF runs in a system thread, separate from the thread that is running the SQL statement.</li>
|
|
<li class="ulchildlink"><strong><a href="rbafyudfparallel.htm">Parallel processing</a></strong><br />
|
|
A UDF can be defined to allow parallel processing.</li>
|
|
<li class="ulchildlink"><strong><a href="rbafysqlpfenced.htm">Fenced or unfenced considerations</a></strong><br />
|
|
When creating a user-defined function (UDF) consider whether to make the UDF an unfenced UDF.</li>
|
|
<li class="ulchildlink"><strong><a href="rbafysaveconsider.htm">Save and restore considerations</a></strong><br />
|
|
When an external function associated with an ILE external program or service program is created, an attempt is made to save the function's attributes in the associated program or service program object.</li>
|
|
</ul>
|
|
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafyudf.htm" title="In writing SQL applications, you can implement some actions or operations as a UDF or as a subroutine in your application: Although it may appear easier to implement new operations as subroutines in your application, you might want to consider the advantages of using a UDF instead.">Use user-defined functions (UDFs)</a></div>
|
|
</div>
|
|
<div class="relinfo"><strong>Related information</strong><br />
|
|
<div><a href="../rzaha/jsqlrout.htm">Java SQL Routines</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |