Re: Passing values between procedures(without actually passing them)

From: Mark D Powell <>
Date: Fri, 29 Jan 2010 07:47:41 -0800 (PST)
Message-ID: <>

On Jan 29, 8:09 am, LPF <> wrote:
> It's possible to achieve something like this?
> Procedure1(param1,param2) IS
> ...
> begin
> Procedure2;
> end Procedure1;
> Procedure2 IS
> ....
> begin
> --Know the parameters values of Procedure1 at this point(with
> dbms_debug, dbms_trace, some V$, ....)
> end Procedure2;
> The point to this is that i have a lot of procedures(like Procedure1)
> calling a Procedure(Procedure2).
> So if this could be achieved, i only have to use a simple line like
> "Procedure2;" to all procedures(and with the advantage of not being
> dependent of the number of parameteres, so future changes wouldn't
> affect the Procedure2 call).
> Thx in advance.

There is a way to define what are in effect global variables for a session. You create a package specification and define all the variables there. As long as the calling procedure has populated the variables the called procedure can access and use them. I am not sure coding like this would put you on the road to hell but it sure would create hell for the programmers who follow you. Also any change to the package specification invalidates all the referencing code on your system, which is not a good thing.

Procedures have parameter lists for a reason. Using parameters appropriately makes for more robust and maintainable code. Global variable belong in packages for use by procedures defined within the package and should be considered for use outside of a single package only in limited circumstances.

You should really rethink your design.

IMHO -- Mark D Powell -- Received on Fri Jan 29 2010 - 09:47:41 CST

Original text of this message