doc-exports/docs/dws/tool/DWS_DS_623.html
Lu, Huayi 346ac31da9 DWS TG 8.1.3.200 VERSION
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Reviewed-by: Jiang, Beibei <beibei.jiang@t-systems.com>
Co-authored-by: Lu, Huayi <luhuayi@huawei.com>
Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
2023-08-28 09:20:17 +00:00

53 lines
15 KiB
HTML

<a name="EN-US_TOPIC_0000001188680998"></a><a name="EN-US_TOPIC_0000001188680998"></a>
<h1 class="topictitle1">Controlling Execution</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p58633867">This section contains the following topics:</p>
<ul id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_ul3178185420"><li id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_li10178281148"><a href="#EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_section1360793411367">Starting Debugging</a></li><li id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_li1156789545"><a href="#EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_section49567323716">Stepping Through a PL/SQL Function</a></li><li id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_li12697230542"><a href="#EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_ref471314683">Continuing the Debug Execution</a></li><li id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_li1491213411048"><a href="#EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_viewcallstack">Viewing Callstack</a></li></ul>
<div class="section" id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_section1360793411367"><a name="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_section1360793411367"></a><a name="en-us_topic_0185264594_section1360793411367"></a><h4 class="sectiontitle">Starting Debugging</h4><p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p1631613394364">Select the function that you want to debug in the <strong id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_b5405549346">Object Browser</strong> pane. Start debugging by clicking <span><img id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_image58557380" src="figure/en-us_image_0000001188521358.jpg"></span> on the toolbar (or any other method as mentioned in the earlier sections). If no breakpoint is set, or the set breakpoint is invalid, the debugging operation will not halt at any statement and Data Studio will simply execute the object and display the results (if any).</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_section49567323716"><a name="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_section49567323716"></a><a name="en-us_topic_0185264594_section49567323716"></a><h4 class="sectiontitle">Stepping Through a PL/SQL Function</h4><p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p45527359">You can step through the debugging execution using the debug step commands from the toolbar. Step controls are used to step through the execution of the program line by line. If a breakpoint is encountered while performing a step operation, the execution will suspend at the breakpoint and the step operation is ended.</p>
<p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p3770133983420">Stepping is the process of running one statement at a time. After stepping through a statement, you can see the execution result in other debugging tabs.</p>
<div class="note" id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_note63837475"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p class="text" id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p37666363">A maximum of 100 <strong id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_b49965631">PL/SQL Viewer</strong> tabs can be displayed at a time. If a new tab beyond 100 is opened, the tab of the calling function is closed. For example, if 100 tabs are already opened and if one of the debug objects calls a new debug object (other than already opened 100 tabs), then Data Studio will close the calling function, and open the new debug object.</p>
</div></div>
</div>
<div class="section" id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_section16046409366"><h4 class="sectiontitle">Step Into</h4><p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p012893682011">To step through code one statement at a time, select <strong id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_b51811544155216">Step Into</strong> from the <strong id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_b101819444523">Debug</strong> menu, or click <span><img id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_image151831644115220" src="figure/en-us_image_0000001234200883.jpg"></span>, or press <strong id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_b101831644105212">F7</strong>.</p>
</div>
<p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p1763915407369">When stepping into a function, Data Studio executes the current statement and then enters the break mode. The debug position will be indicated by an arrow <span><img id="EN-US_TOPIC_0000001188680998__image147482317292" src="figure/en-us_image_0000001188362808.jpg"></span> on the left ruler pane. If the executed statement calls another function, Data Studio will step into that function. Once you have stepped through all the statements in that function, Data Studio will jump back to the next statement of the function it was called from.</p>
<p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p12639640123615">To go into the next statement, click the <strong id="EN-US_TOPIC_0000001188680998__b187971336122716">Step Into </strong>button or press <strong id="EN-US_TOPIC_0000001188680998__b890454912294">F7</strong> again. If you click the <strong id="EN-US_TOPIC_0000001188680998__b19904194992919">Continue</strong> button, PL/SQL code execution will continue.</p>
<p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p12639640193619">An example is as follows:</p>
<p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p86391840163614">When entering line 8, enter <strong id="EN-US_TOPIC_0000001188680998__b299411379188">m := F3_TEST();</strong>. That is, go to the line 9 in <strong id="EN-US_TOPIC_0000001188680998__b970615421810">f3_test()</strong>. You can step through all the statements in <strong id="EN-US_TOPIC_0000001188680998__b179861412191919">f3_test()</strong> by stepping into each line by clicking the <strong id="EN-US_TOPIC_0000001188680998__b0462104219283">Step Into </strong>button or pressing <strong id="EN-US_TOPIC_0000001188680998__b316533710312">F7</strong> repeatedly. Once you have stepped through all the statements in that function, Data Studio jumps to <em id="EN-US_TOPIC_0000001188680998__i785117195320">Line 10</em> in <em id="EN-US_TOPIC_0000001188680998__i14851131915326">f2_test()</em>.</p>
<p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p263994011363">The currently debugging object is marked with the <span><img id="EN-US_TOPIC_0000001188680998__image6201328123311" src="figure/en-us_image_0000001188521360.jpg"></span> symbol in the tab title with the function name.</p>
<p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p930254353910"><span><img id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_image03021743153918" src="figure/en-us_image_0000001233800823.jpg"></span></p>
<div class="section" id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_section66365173377"><h4 class="sectiontitle">Step Over</h4><p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p828564832013">Stepping over is the same as Stepping into, except that when it reaches a call for another function, it will not step into the function. The function will run, and you will be brought to the next statement in the current function. <strong id="EN-US_TOPIC_0000001188680998__b1668345203414">F8</strong> is the shortcut key for <strong id="EN-US_TOPIC_0000001188680998__b1468335153414">Step Over</strong>. However, if there is a breakpoint set inside the called function, <strong id="EN-US_TOPIC_0000001188680998__b9980312183410">Step Over</strong> will enter the function, and hit the set breakpoint.</p>
</div>
<p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p11639134053618">In the below example, when you click <strong id="EN-US_TOPIC_0000001188680998__b1495152003410">Step Over</strong> in <em id="EN-US_TOPIC_0000001188680998__i99502015345">Line 10</em>, Data Studio runs the <em id="EN-US_TOPIC_0000001188680998__i129515209340">f3_test()</em> function.</p>
<p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p0789455143918"><span><img id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_image1789155512390" src="figure/en-us_image_0000001188202718.jpg"></span></p>
<p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p463914405361">The cursor will be moved to the next statement in <em id="EN-US_TOPIC_0000001188680998__i1602229193413">f2_test()</em>, that is, <em id="EN-US_TOPIC_0000001188680998__i760282953413">Line 11</em> in <em id="EN-US_TOPIC_0000001188680998__i1760282910341">f2_test()</em>.</p>
<p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p1476620664018"><span><img id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_image17766106154014" src="figure/en-us_image_0000001188521236.jpg"></span></p>
<p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p864074012363">You can step over a function when you are familiar with the way the function works and are sure that its execution will not affect the issue that you are investigating.</p>
<div class="note" id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_note146401340113620"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p class="text" id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p1564004017361">Stepping over a line of code that does not contain a function call executes the line just like stepping into the line.</p>
</div></div>
<div class="section" id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_section1856923733710"><h4 class="sectiontitle">Step Out</h4><p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p8612165912015">Stepping out of a sub-program continues execution of the function and then suspends execution after the function returns to its calling function. You can step out of a long function when you have determined that the rest of the function is not significant to debug. However, if a breakpoint is set in the remaining part of the function, then that breakpoint will be hit before returning to the calling function.</p>
</div>
<p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p1364084016361">Both stepping over and stepping out of a function will execute a function. The shortcut key for the step out operation is <strong id="EN-US_TOPIC_0000001188680998__b133391045173514">Shift</strong>+<strong id="EN-US_TOPIC_0000001188680998__b1633964513510">F7</strong>.</p>
<p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p653231517409"><span><img id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_image3532141544010" src="figure/en-us_image_0000001188521238.jpg"></span></p>
<p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p13640640133620"></p>
<p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p166401640123620">In the preceding example,</p>
<ul id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_ul6640164003617"><li id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_li1864014014361">Choose <strong id="EN-US_TOPIC_0000001188680998__b101240103615">Debug &gt; Step Into</strong> to step into <em id="EN-US_TOPIC_0000001188680998__i171240183616">f3_test()</em>.</li><li id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_li18640104017367">Choose <strong id="EN-US_TOPIC_0000001188680998__b1675145103612">Debug &gt; Step Out </strong>to step out of <em id="EN-US_TOPIC_0000001188680998__i575110516362">f3_test()</em></li></ul>
<div class="section" id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_ref471314683"><a name="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_ref471314683"></a><a name="en-us_topic_0185264594_ref471314683"></a><h4 class="sectiontitle">Continuing the Debug Execution</h4><p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p33770688">When the debugging process stops at a specific location, you can select <strong id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_b3194617">Continue</strong> (<strong id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_b34680106183311">F9</strong>) from the <strong id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_b28751554">Debug Menu</strong> or click <span><img id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_image57437397" src="figure/en-us_image_0000001234200877.jpg"></span> button from the toolbar to continue the PL/SQL function execution.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_viewcallstack"><a name="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_viewcallstack"></a><a name="en-us_topic_0185264594_viewcallstack"></a><h4 class="sectiontitle">Viewing Callstack</h4><p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p52581080">The <strong id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_b63040734">Callstack</strong> pane displays the chain of functions as they are called. The Callstack pane can be opened from the minimized window panel. The most recent functions are listed on the top, and the least recent on the bottom. At the end of each function name is the current line number in that function.</p>
<p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p12446250">You can navigate among multiple functions through the <strong id="EN-US_TOPIC_0000001188680998__b772811409383">Callstack</strong> pane by double-clicking the function name in the <strong id="EN-US_TOPIC_0000001188680998__b15728840143814">Callstack</strong> pane. For example, when <em id="EN-US_TOPIC_0000001188680998__i2181651193815">f2_test()</em> calls <em id="EN-US_TOPIC_0000001188680998__i51805153813">f3_test()</em> at <em id="EN-US_TOPIC_0000001188680998__i141985163810">Line 10</em>, the debug pointer will point to the first valid executable line (which is <em id="EN-US_TOPIC_0000001188680998__i1419051153815">Line 9</em>, in the above example) in the called function.</p>
<p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p13620192">In this case, the <strong id="EN-US_TOPIC_0000001188680998__b1931156153913">Callstack</strong> pane will be as shown below:</p>
<p id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p29493756"><span><img id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_image57075007" src="figure/en-us_image_0000001188362684.jpg"></span></p>
<div class="note" id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_note40183996"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p class="text" id="EN-US_TOPIC_0000001188680998__en-us_topic_0185264594_p26111645">The content of the <strong id="EN-US_TOPIC_0000001188680998__b1464791093917">Callstack</strong> pane can be copied to the clipboard using <strong id="EN-US_TOPIC_0000001188680998__b18647181093913">Alt</strong>+<strong id="EN-US_TOPIC_0000001188680998__b1964781020395">J</strong>.</p>
</div></div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="DWS_DS_62.html">Debugging a PL/SQL Function</a></div>
</div>
</div>