ibm-information-center/dist/eclipse/plugins/i5OS.ic.sqlp_5.4.0.1/rbafyuseunqualified.htm

76 lines
5.0 KiB
HTML
Raw Permalink 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="reference" />
<meta name="DC.Title" content="Use unqualified function reference" />
<meta name="abstract" content="You can use an unqualified function reference instead of a qualified function reference. In this case, DB2's search for a matching function normally uses the function path to qualify the reference." />
<meta name="description" content="You can use an unqualified function reference instead of a qualified function reference. In this case, DB2's search for a matching function normally uses the function path to qualify the reference." />
<meta name="DC.subject" content="UDFs (User-defined functions), calling, unqualified function reference, examples" />
<meta name="keywords" content="UDFs (User-defined functions), calling, unqualified function reference, examples" />
<meta name="DC.Relation" scheme="URI" content="rbafyudfuudf.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafyusquref.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="rbafyuseunqualified" />
<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>Use unqualified function reference</title>
</head>
<body id="rbafyuseunqualified"><a name="rbafyuseunqualified"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Use unqualified function reference</h1>
<div><p>You can use an unqualified function reference instead of a qualified
function reference. In this case, DB2's search for a matching function normally
uses the function path to qualify the reference.</p>
<div class="section"><p>In the case of the DROP FUNCTION or COMMENT ON FUNCTION functions,
the reference is qualified using the current authorization ID, if they are
unqualified for *SQL naming, or *LIBL for *SYS naming. Thus, it is important
that you know what your function path is, and what, if any, conflicting
functions exist in the schemas of your current function path. For example,
suppose you are PABLO and your static SQL statement is as follows, where
COLUMN1 is data type INTEGER:</p>
<pre> <strong>SELECT</strong> BLOOP(COLUMN1) <strong>FROM</strong> T</pre>
</div>
<div class="section"><p>You have created the two BLOOP functions in the section Using
qualified function reference,
and you want and expect one of them to be chosen. If the following default
function path is used, the first BLOOP is chosen (since COLUMN1 is INTEGER),
if there is no conflicting BLOOP in QSYS or QSYS2:</p>
<pre> "QSYS","QSYS2","PABLO"</pre>
</div>
<div class="section"><p>However, suppose you have forgotten that you are using a script
for precompiling and binding which you previously wrote for another purpose.
In this script, you explicitly coded your SQLPATH parameter to specify the
following function path for another reason that does not apply to your current
work:</p>
<pre> "KATHY","QSYS","QSYS2","PABLO"</pre>
</div>
<div class="section"><p>If there is a BLOOP function in schema KATHY, the function selection
can very well resolve to that function, and your statement executes without
error. You are not notified because DB2<sup>®</sup> assumes that you know what you are
doing. It is your responsibility to identify the incorrect output from your
statement and make the required correction. </p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafyudfuudf.htm" title="Scalar and column UDFs can be called within an SQL statement almost everywhere that an expression is valid. Table UDFs can be called in the FROM clause of a SELECT. There are a few restrictions of UDF usage, however.">Use UDFs in SQL statements</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="rbafyusquref.htm" title="If you use a qualified function reference, you restrict the search for a matching function to that schema.">Use qualified function reference</a></div>
</div>
</div>
</body>
</html>