Debugging Stored Procedures
- How to debug a procedure using the SQLScript debugger
- This tutorial is designed for SAP HANA on premise and SAP HANA, express edition. It is not designed for SAP HANA Cloud.
- Tutorials: Anonymous Blocks
The debugging shown in this tutorial includes setting breakpoints, evaluating expressions and intermediate results.
- Step 1
Go to the Database Explorer page and right-click on the procedure called
get_po_header_dataand choose Open for Debugging.
Make sure the configuration is set as shown here and click OK.
- Step 2
Set breakpoints at the lines shown here by simply clicking on the line number.
Right click on the procedure and choose Generate Call Statement
A new SQL tab will be opened. Click on the Run button.
- Step 3
Execution of the procedure has started, and a debugger pane is now visible which is displayed on the right. You can see all of the variables and parameters for this procedure. You might notice that this pane is currently not showing the intermediate table variables at this point.
- Step 4
Click the Step Over button.
You will notice that execution has continued to the next statement. In the debugger pane, a new local variable has been added. This is because it is not defined explicitly and will be implicitly declared at runtime during first usage.
To see the data for this intermediate table variable, select it and click Display Content
A new window is then opened showing the data in the table. Review the data and close the window by clicking Close
- Step 5
Click the Expression tab and click + button.
In the following window, enter a SELECT statement as shown here and hit Add.
You will notice the expression is then added to the “Expressions” section.
- Step 6
Select the expression and click Display Content.
Review the results and close the window.
- Step 7
Once again click the Step Over button. Notice the next intermediate table variables is also added. You can review the data in this table as well.
Continue to step through the code and when execution stops at the END statement of the procedure, display the contents of the output parameter the same way you did for the intermediate table variables. Finally, close the window by clicking the Close.
- Step 8
Click the Resume button.
Execution of the procedure is now completed. Return to the SQL tab and check the results.