PL/SQL - Debug.f for debugging application

About

It's a package designed to allow you to add logging or trace statements to a PL/SQL application.

Example

create procedure p ( p_owner in varchar2, p_object_name in varchar2)
as
    l_status number := 0 ;
Begin
    Debug.f ('Entering procedure', inputs "%s", "%s" )
    --.... some code ....
    Debug.f ('Normal exit, status = %d', l_status );
end;

If the debug package where told to generate a trace file via a call to debug.init, you will have this :

12062002 213953(P.PROCEDURE  5) Enter procedure inputs "A", "B"
12062002 213955(P.PROCEDURE 56) Normal exit, status = 0

Where :

  • 12062002 is the date MMDDYYYY format
  • 213953 is the time HH24MISS format

How to install it

      create user utility identified by utility;
      grant create session, create procedure, create table, create trigger to utility;
      alter user utility default tablespace users quota unlimited on users;
  • run install_debug in that schema
  • create a public synonym for debug

Reference


Powered by ComboStrap