SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
โคข Open full site

Troubleshoot SQL with SAP HANA Database Explorer

Explore the available tools to help diagnose and debug SQL or SQLScript.

Overview

🎓 beginner 20 min. SAP HANA CloudBeginnerSAP HANA Cloud SAP HANA DatabaseSAP HANASAP HANA Express Edition

You will learn

  • โœ”How to debug SQLScript
  • โœ”How to use code coverage and SQLScript code analysis
  • โœ”About the tools available to assist in performance analysis (explain plan, SQL Analyzer)
  • โœ”How to configure and examine traces
Unknown U Unknown May 11, 2026
Created by October 20, 2020
Contributors

Prerequisites

Prerequisites

  • An SAP HANA database such as SAP HANA Cloud, HANA database trial or the SAP HANA, express edition that includes the SAP HANA database explorer
  • You have completed the first 3 tutorials in this group.

Steps

Step 1 Debugger
โ€”

The debugger can be used to help find issues in procedures, functions, or anonymous blocks. The steps below demonstrate how to use the debugger to debug a procedure.

  1. To start a debugging session, navigate to the procedure RESERVATION_GENERATOR, right-click, and select Open For Debugging.

    Open For Debugging
    Open For Debugging

  2. From the Debugger Attach Options dialog, ensure that SQL console connections is selected.

    Debugger Attach Options
    Debugger Attach Options

    Anonymous blocks can also be debugged if the Stop at execution start option is checked. An example of an anonymous block is shown below.

    SQL
    DO BEGIN
        USING SQLSCRIPT_PRINT AS PRTLIB;
        DECLARE count INT := 0;
        SQLQUERY = SELECT count(*) C from MAINTENANCE;
        SELECT C INTO count from :SQLQUERY;
        PRTLIB:PRINT_LINE(CONCAT('Entries in the maintenance table is: ', count));
    END
  3. Set breakpoints in the procedure by clicking next to the line number. A check mark will appear next to the line number to indicate that a breakpoint has been set.

    Set Breakpoints
    Set Breakpoints

  4. Right-click the procedure named RESERVATION_GENERATOR in the database browser and select Generate Call Statement.

    Generate Call Statement
    Generate Call Statement

    A call statement for the procedure will open in a new SQL console. Provide an input parameter value, such as 10, and run the statement.

    Run call statement
    Run call statement

  5. When the breakpoint is hit, execution will suspend.

    Debugger Suspended
    Debugger Suspended

    The current values of any variables used can be examined. It is possible to modify the value of certain local and global variables by clicking the edit button highlighted above.

    Debugger Variables
    Debugger Variables

  6. Execution can be continued by using the navigation icons at the top of the debugger. The debugging session can be stopped by using the detach icon.

    Debugger Navigation Icons
    Debugger Navigation Icons

    For more information on the SAP database explorer debugger, see the Debugger Tutorials.

Step 2 Code coverage
+
Step 3 SQLScript analysis
+
Step 4 Explain plan
+
Step 5 SQL Analyzer
+
Step 6 SQL trace
+
Step 7 Expensive statements trace
+
Step 8 Viewing trace files with SQL
+
Step 9 Data lake Relational Engine diagnostic files
+
Step 10 Knowledge check
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 10
1. Debugger 2. Code coverage 3. SQLScript analysis 4. Explain plan 5. SQL Analyzer 6. SQL trace 7. Expensive statements trace 8. Viewing trace files with SQL 9. Data lake Relational Engine diagnostic files 10. Knowledge check

Learn more →