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

80 lines
5.5 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="concept" />
<meta name="DC.Title" content="Debug an SQL routine" />
<meta name="abstract" content="By specifying SET OPTION DBGVIEW = *SOURCE in your Create SQL Procedure, Create SQL Function, or Create Trigger statement, you can debug the generated program or module at the SQL statement level." />
<meta name="description" content="By specifying SET OPTION DBGVIEW = *SOURCE in your Create SQL Procedure, Create SQL Function, or Create Trigger statement, you can debug the generated program or module at the SQL statement level." />
<meta name="DC.subject" content="routine, debugging, CREATE PROCEDURE statement, statements, CREATE PROCEDURE, examples, debugging routine" />
<meta name="keywords" content="routine, debugging, CREATE PROCEDURE statement, statements, CREATE PROCEDURE, examples, debugging routine" />
<meta name="DC.Relation" scheme="URI" content="rbafyroutines.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafysqltrig.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="rbafydebugproc" />
<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>Debug an SQL routine</title>
</head>
<body id="rbafydebugproc"><a name="rbafydebugproc"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Debug an SQL routine</h1>
<div><p>By specifying SET OPTION DBGVIEW = *SOURCE in your Create SQL
Procedure, Create SQL Function, or Create Trigger statement, you can debug
the generated program or module at the SQL statement level. </p>
<p>You can also specify DBGVIEW(*SOURCE) as a parameter on a RUNSQLSTM command
and it will apply to all routines within the RUNSQLSTM.</p>
<p>The source view will be created by the system from your original routine
body into source file QSQDSRC in the routine library. If the library cannot
be determined, QSQDSRC is created in QTEMP. The source view is not saved with
the program or service program. It will be broken into lines that correspond
to places you can stop in debug. The text, including parameter and variable
names, will be folded to uppercase.</p>
<p>All variables and parameters are generated as part of a structure. The
structure name must be used when evaluating a variable in debug. Variables
are qualified by the current label name. Parameters are qualified by the
procedure or function name. Transition variables in a trigger are qualified
by the appropriate correlation name. It is highly recommended that you specify
a label name for each compound statement or FOR statement. If you don't specify
one, the system will generate one for you. This will make it nearly impossible
to evaluate variables. Remember that all variables and parameters must be
evaluated as an uppercase name. You can also eval the name of the structure.
This will show you all the variables within the structure. If a variable
or parameter is nullable, the indicator for that variable or parameter immediately
follows it in the structure.</p>
<p>Because SQL routines are generated in C, there are some restrictions in
C that also affect SQL source debug. Delimited names that are specified in
the SQL routine body cannot be specified in C. Names are generated for these
names, which again makes it difficult to debug or eval. In order to eval
the contents of any character variable, specify an * prior to the name of
the variable.</p>
<p>Since the system generates indicators for most variable and parameter
names, there is no way to check directly to see if a variable has the SQL
null value. Evaluating a variable will always show a value, even if the indicator
is set to indicate the null value.</p>
<p>In order to determine if a handler is getting called, set a breakpoint
on the first statement within the handler. Variables that are declared in
a compound statement or FOR statement within the handler can be evaluated.</p>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafyroutines.htm" title="Routines are pieces of code or programs that you can call to perform operations.">Routines</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="rbafysqltrig.htm" title="The SQL CREATE TRIGGER statement provides a way for the database management system to actively control, monitor, and manage a group of tables and views whenever an insert, update, or delete operation is performed.">SQL triggers</a></div>
</div>
</div>
</body>
</html>