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: stored procedure variable persistence

Re: stored procedure variable persistence

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: 2000/03/31
Message-ID: <954519778.16032.0.pluto.d4ee154e@news.demon.nl>#1/1

As packages are multi-entrant, each session will have it's own value for the duration of the session.
Once you disconnect or get disconnected, the package data is removed from memory.

Hth,

Sybrand Bakker, Oracle DBA

Jay M. Scheiner <jxs_at_wolpoff_nospm_law.com> wrote in message news:38e4f90a.1726442200_at_news.erols.com...
> What is the duration of the life of the package? If I call it 10
> times today, I'll get 1..2... thru 10
>
> Then, I shut down the datbase (or it crashes, etc). I assume the 1st
> call to the procedure will return '1'
>
> If I don't shut down/crash or have a function that manually resets the
> count, will it increment forever (to the limit of the number size)?
> Keep in mind that the package is being called from a remote machine
> running a C based program, and that the connection between the
> machines might be lost or closed at some point. Will that reset the
> counter variable?
>
> Thanks for the help.
>
> On Thu, 30 Mar 2000 21:55:03 GMT, Thomas J. Kyte <tkyte_at_us.oracle.com>
> wrote:
>
>
> >
> >Packages are the answer. A package will maintain state from call to
> >call.
> >
> >create package my_pkg
> >as
> > procedure do_something( x out number );
> >end;
> >/
> >
> >create package body my_pkg
> >as
> >
> > global_persistent_counter number default 0;
> >
> > procedure do_something( x out number )
> > is
> > begin
> > global_persistent_counter := global_persistent_counter+1;
> > x := global_persistent_counter;
> > end;
> >end;
> >/
> >
> >
> >every time you call that -- it'll return 1 larger number.
> >
> >> Jay M. Scheiner
> >> Programmer/Analyst
> >> Wolpoff & Abramson, LLP
> >> remove _nospm_ from email address
> >> Opinions are my own only!
> >> To email, remove _nospm_ from address.
> >>
> >--
> >Thomas Kyte tkyte_at_us.oracle.com
> >Oracle Service Industries http://osi.oracle.com/~tkyte/index.html
> >--
> >Opinions are mine and do not necessarily reflect those of Oracle Corp
> >
> >
> >Sent via Deja.com http://www.deja.com/
> >Before you buy.
>
>
> _______________
> Jay M. Scheiner
> Programmer/Analyst
> Wolpoff & Abramson, LLP
> remove _nospm_ from email address
> Opinions are my own only!
Received on Fri Mar 31 2000 - 00:00:00 CST

Original text of this message

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