RE: Are PL/SQL variable values runtime only?
Date: Wed, 22 Jul 2009 14:10:20 -0500 (CDT)
I'm not questioning the scope of the variable, but the timing of the evaluation of the "my_pkg.my_value" function.
Contrast this example with my original:
CREATE OR REPLACE PROCEDURE new_bleah AS
v_test := my_pkg.my_value('ABC');
This function clearly sets the value of "v_test" at runtime.
However, the original "bleah" function also sets the value of "v_test" at runtime, even though the assignment is in the DECLARE (variable) section and not in the BEGIN (code) section. I would have expected it to happen at compile time.
Hopefully that's a little clearer explanation?
> Hi Rich,
> The short answer is yes. The life of a variable is only within the
> block that it's defined. You can create variables in a package header
> that have a more global like life span. Although I'm not sure I totally
> understand what you are asking so maybe I'm off the mark here.
> I think this is covered in the scoping rules of the PL/SQL guide.
> Ric Van Dyke
> -----Original Message-----
> From: oracle-l-bounce_at_freelists.org
> [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Rich Jesse
> CREATE OR REPLACE PROCEDURE bleah AS
> v_test VARCHAR2(50) := my_pkg.my_value('ABC');
> END bleah;