Votes

PLSQL Program Variables State (details)
 
Dear Bryn,

I love PL/SQL and it would be great if you could it easier for us to obtain and log the values/state of all arguments and local variables in a subprogram.

This is incredibly useful when tracing execution and logging errors.

Thanks!

When an exception is raised in a PLSQL program, developers usually need to re-run the program with some trace statements, in order to inspect the values of local and input/output variables at the time exception occurred. This is to gain more information so that the problem can be fixed.


Having a facility in Oracle to dump the state of all local and input/output variables would help a lot. This will be something similar to a WATCH in debug mode.


CREATE OR REPLACE FUNCTION raise_error(pi_arg1 NUMBER, pi_arg2 NUMBER, ....)
IS
l_arg1 NUMBER;
l_arg2 NUMBER;
BEGIN
........
-- Processing

EXCEPTION
 WHEN OTHERS THEN
   -- Exception is raised and control comes here.

END;


CREATE OR REPLACE FUNCTION raise_error(pi_arg1 NUMBER, pi_arg2 NUMBER, ....)
IS
l_arg1 NUMBER;
l_arg2 NUMBER;
BEGIN
........
-- Processing

EXCEPTION
 WHEN OTHERS THEN
   -- Exception is raised and control comes here.
   -- Dump the state of l_arg1, pi_arg1, pi_arg2..
END;


Steven Feuerstein, PL/SQL Evangelist, Quest Software: "Help me help Oracle improve the PL/SQL language!"


Bryn Llewellyn: "We love to hear from PL/SQL developers. Let us know what is important to you!"

PL/SQL Obsession
Apex Evangelists
O'Reilly Books on Oracle
OTN PL/SQL Best Practices
OTN PL/SQL Page
Steven Feuerstein's Blog