Thursday, November 13, 2008

Debug plsql procedure/function in TOAD when executed by external application

Debug plsql procedure/function in TOAD when executed by external application
Step Over: Execute one line of code at a time but does not go into any called procedures or functions.
Trace Into: Execute one line of code at a time and does go to any called procedure or functions and executing its code one line at a time as well.
Trace Out: Returns the execution to calling routine and stopping on next line of code after call statement.
Breakpoint: Stop execution at the line with breakpoint
Add Watch: Watches allow to the contents of specific variables.


For tutorials on google:

Toad for Oracle Tutorials - debug

Step 0:
grant DEBUG CONNECT SESSION to system;

revoke DEBUG CONNECT SESSION from system;

Step 1:

Anonymous Block
-- run this in your client session
-- first block gets the debug session ready
DECLARE
id VARCHAR2(255);
BEGIN
id := DBMS_DEBUG.INITIALIZE('TOAD_EXAMPLE');
DBMS_DEBUG.DEBUG_ON;
END;
/

Step 2:

--this fires off your stored pl/sql object so it can be debugged.
BEGIN
KARAM.LOOP_INSERT;
DBMS_DEBUG.DEBUG_OFF;
END;
/

Step 3:

Now attach session in TOAD

No comments: