Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: globally visible variables in plsql package stored procedures

Re: globally visible variables in plsql package stored procedures

From: Vladimir M. Zakharychev <bob_at_dpsp-yes.com>
Date: Wed, 5 Mar 2003 18:59:38 +0300
Message-ID: <b456v2$5av$1@babylon.agtel.net>


If the procedures are executed in different *sessions*, then it's not possible to set a variable in one session and retrieve it in another regardless where you declare it - in the package specification or in the package header - each session receives its own "copy" of the package state. If the procedures are executed consecutively in one session, there should be no problem reading the value set by a previous call in the same session, unless the session was reset in between (for example, using DBMS_SESSION.RESET_PACKAGE.) If you need a cross-session solution, you can try to use alerts (DBMS_ALERT) to broadcast the new value to all interested parties, or you can use global application contexts (introduced in 9.2, in previous versions they were bound to sessions just like package variables.)

--
Vladimir Zakharychev (bob@dpsp-yes.com)                http://www.dpsp-yes.com
Dynamic PSP(tm) - the first true RAD toolkit for Oracle-based internet applications.
All opinions are mine and do not necessarily go in line with those of my employer.


"Miquel Salvā" <msalva_at_3digits.es> wrote in message news:1046879200.830312_at_srv0...

> Hi,
>
> I would like to know how to declare a variable in a plsql package so it's
> visible to all other procedures in that package, in order to assign a value
> in one procedure and be able to use it in other procedures.
>
> If I declare the variable in the package body (not inside a procedure) it's
> visible to all the procedures of the package. But trying to read from some
> procedure the value I have assigned to a variable in another procedure
> always returns null.
>
> Any ideas?
>
> Thank you.
>
>
> Miquel Salvā
> msalva_at_3digits.es
>
>
Received on Wed Mar 05 2003 - 09:59:38 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US