Sqldeveloper debugger

This article presents how to use debugger in Sqldeveloper.

Oracle SqlDeveloper is very popular application between developers. I’d like to show you how easy you can debug your code.

First you need to create simple procedure and compile it for debug. You can do it in sqldeveloper if you want

CREATE OR REPLACE PROCEDURE my_code
IS
  v_id NUMBER := 5;
BEGIN
  FOR i IN 1..v_id
  LOOP
    DBMS_OUTPUT.put_line(i);
  END LOOP;
END;
/
 
ALTER PROCEDURE my_code compile debug;

Next just click on left panel to edit the procedure. When you are in editor you can compile procedure with debug option as well by clicking icon compile with debug or without.

Next step is just set breakpoint for our code to debug. I did it for line 8. Breakpoint is place in code where debugger stops execution of your code and give you full control for next steps.

So we are ready to run our procedure in debug mode. Just click on “lady-bug” icon or use combination key to start debug “Ctrl+Shift-F10”

You should see following screen where you can modify your starting code before running the procedure in debug mode. It’s place where you can set your input parameters add extra code. In our case we don’t have any parameters so just click “OK” button. It will run our procedure in “real-time” debug mode.

when it’s done debug session is started and code execution has stopped on our breakpoint.

There are many thing that you can check/do during debug. For example you can add new breakpoints, jump between breakpoints, execute code line after line(F8), check current variables value, modify values for your variable and many many more.

By simple clicking F8(step over) we jump into next iteration of our code. The same can be done by clicking F7(step into). The difference between F7 and F8 is visible when your code is calling other procedure/function – compiled in debug mode. F8 just calls the procedure/function and wait till it finish unless it has breakpoint set inside so jumps to the brekpoint. F7 calls new procedure/function line by line.

Have a fun 🙂

Tomasz

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.