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: Jay M. Scheiner <jxs_at_wolpoff_nospm_law.com>
Date: 2000/03/31
Message-ID: <38e4f90a.1726442200@news.erols.com>#1/1

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