Linker IT Software
Order Home
menubar-top-links menubar-top-rechts
SQL*XL: Database to Excel bridge
Home Products SQL*Debug

Buy now

Download now

Debugging PL/SQL by printing debug messages into a windows program.

SQL*Debug is a PL/SQL debugger. It prints debug messages from PL/SQL into a windows program. You can call SQL*Debug from anywhere in pl/sql using the following syntax:

OraDebug.debug( 'your text goes here' );

With the SQL*Debug windows program you register for debug messages from a particular session. If no SQL*Debug program is listening for messages, the debug messages are simply not generated. Therefore no performance degradation occurs when calling SQL*Debug.debug.

Apart from the ad-hoc debug session you can use SQL*Debug to monitor your PL/SQL packages. You can code for each public function or procedure a general exception handler where you call SQL*Debug:

  when others then
    OraDebug.debug('Error in mypack.myproc:' || sqlerrm(sqlcode)  );
    raise;  --propagate the error

The reason why this use of SQL*Debug is so valuable is that the above code does not degrade performance. If nothing unexpected goes wrong, SQL*Debug is not executed. If a user experiences problems you can point the SQL*Debug windows program to the user's session and see the error messages come to your screen. To demonstrate this consider the following example:

I've logged in as SCOTT and execute the following pl/sql. Note that this sql may have also been e.g. a package, trigger or even a Forms library!.

I make the deliberate mistake loading about 20 characters into a varchar buffer of length 3.


Use SQL*Debug to choose the session you want to see the debug messages for.


In the SQL*Debug main program you see that the error message appears in the log. Each item is timestamped (day-month hour:min:ss:ms) and the time is calculated between the messages, giving you some feel for performance.

Screen print

SQL-Debug homepage