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: Karsten Farrell <kfarrell_at_belgariad.com>
Date: Wed, 05 Mar 2003 16:53:02 GMT
Message-ID: <MPG.18cfcb46a233957d9896dc@news.la.sbcglobal.net>


bob_at_dpsp-yes.com said...
> 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
> >
> >
>
>

Or another option: use the old standard way - provide a "get value" function and a "put value" procedure in the package. Then call these routines from the other session.

-- 
/Karsten
DBA > retired > DBA
Received on Wed Mar 05 2003 - 10:53:02 CST

Original text of this message

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