<?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="Error processing for UDFs" /> <meta name="abstract" content="When an error is encountered when processing a UDF, the system follows a specified model." /> <meta name="description" content="When an error is encountered when processing a UDF, the system follows a specified model." /> <meta name="DC.subject" content="table function, UDFs (User-defined functions), error processing, scalar function, UDFs (User-defined functions), scalar function" /> <meta name="keywords" content="table function, UDFs (User-defined functions), error processing, scalar function, UDFs (User-defined functions), scalar function" /> <meta name="DC.Relation" scheme="URI" content="rbafywudfextern.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="rbafyudferror" /> <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>Error processing for UDFs</title> </head> <body id="rbafyudferror"><a name="rbafyudferror"><!-- --></a> <!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script> <h1 class="topictitle1">Error processing for UDFs</h1> <div><p>When an error is encountered when processing a UDF, the system follows a specified model.</p> <div class="section"><h4 class="sectiontitle">Table function error processing</h4><p>The error processing model for table function calls is as follows: </p> </div> <div class="section"> <ol><li>If FIRST call fails, no further calls are made.</li> <li>If FIRST call succeeds, the nested OPEN, FETCH, and CLOSE calls are made, and the FINAL call is always made.</li> <li>If OPEN call fails, no FETCH or CLOSE call is made.</li> <li>If OPEN call succeeds, then FETCH and CLOSE calls are made.</li> <li>If a FETCH call fails, no further FETCH calls are made, but the CLOSE call is made.</li> </ol> </div> <div class="section"> <div class="note"><span class="notetitle">Note:</span> This model describes the ordinary error processing for table UDFs. In the event of a system failure or communication problem, a call indicated by the error processing model may not be made. </div> </div> <div class="section"><h4 class="sectiontitle">Scalar function error processing</h4><p>The error processing model for scalar UDFs, which are defined with the FINAL CALL specification, is as follows: </p> </div> <div class="section"> <ol><li>If FIRST call fails, no further calls are made. </li> <li>If FIRST call succeeds, then further NORMAL calls are made as warranted by the processing of the statement, and a FINAL call is always made.</li> <li>If NORMAL call fails, no further NORMAL calls are made, but the FINAL call is made (if you have specified FINAL CALL). This means that if an error is returned on a FIRST call, the UDF must clean up before returning, because no FINAL call will be made. </li> </ol> </div> <div class="section"> <div class="note"><span class="notetitle">Note:</span> This model describes the ordinary error processing for scalar UDFs. In the event of a system failure or communication problem, a call indicated by the error processing model may not be made.</div> </div> </div> <div> <div class="familylinks"> <div class="parentlink"><strong>Parent topic:</strong> <a href="rbafywudfextern.htm" title="You can write the executable code of a UDF in a language other than SQL.">Write UDFs as external functions</a></div> </div> </div> </body> </html>