Introducing the New SAP HANA SQLScript Debugger
For those who have been working with SQLScript for awhile, you know that it is quite cumbersome to try and figure out what has gone wrong when a procedure does not return the correct results. Of course we have the TRACE statement which can be inserted into the SQLScript procedure which then writes out the intermediate results to a trace table during execution. But this approach is flawed. Firstly, the inspection of the results has to be done after the entire procedure execution is complete. You can’t see the results in real-time as the code is being executed. Secondly, and maybe most importantly, what customer will allow you to insert TRACE statements into a procedure directly in a productive environment? We need the ability to trace variables during execution without having to modify the procedure in any way. Would it not be great for developers, and support personnel to be able to debug SQLScript procedures directly using a real integrated debugger? Well, good news! With the release of SAP HANA 1.0 SP5, I am pleased to announce the availability of the new SQLScript Debugger!
The new debugger is tightly integrated into SAP HANA Studio. It uses the standard eclipse “Debug” perspective, so there is basically zero learning curve for those who are familiar with debugging in eclipse. You can set/remove breakpoints, resume to the next breakpoint, and terminate the debug session. Other step features are still in the planning phases.
The most powerful feature of the debugger is of course the variable evaluation feature. When the procedure is executed in the debugger, all of the variables are listed in the “Variables” tab including table variables. You can evaluate the values of the variables as you execute each statement of the SQLScript code. For table variables, you can right-click and choose “Open Preview”. This will open a tab at the bottom showing the data in table format.
As you probably have already realized, the new SQLScript debugger is a huge deal for HANA developers. We can now debug SQLScript procedures on the fly and see exactly what is going on during execution of each statement. Currently, the debugger does have some restrictions which we are working to resolve over the next several revisions. A list of these restrictions is documented in SAP Note 1779803. Finally, look for new videos coming soon to SAP HANA Academy page showing how to use the new development tools delivered with SAP HANA 1.0 SP5.