Re: global context instead of for update or another idea ?
Date: Fri, 5 Sep 2008 06:35:04 -0700 (PDT)
Message-ID: <dda3e557-4732-481c-8b33-5071f5bcd9d1@f63g2000hsf.googlegroups.com>
On Sep 5, 8:47 am, "fitzjarr..._at_cox.net" <orat..._at_msn.com> wrote:
> Comments embedded.
> On Sep 5, 2:43 am, hopehope_123 <hopehope_..._at_yahoo.com> wrote:
>
> > Hi ,
>
> > is it possible to use global variables in oracle? and is there any
> > way to control concurrency on this memory variable?
>
> Why?
>
> > i can use a table, and read this by using for update. Under heavy
> > loads, this will create contention.
>
> What is it you're doing that 'requires' this?
>
> > what else can i do?
>
> > i try to use sequence data variable. there are multiple sessions.
> > when one session reads next value, others must wait ,
>
> No, they don't.
>
> > and this
> > creates contention also.
>
> Not in my experience.
>
> > and i need to use reuse values so
> > sequence does not allow to use older values.
>
> Certainly it does, this is precisely why there is a CURRVAL call to a
> sequence, to reuse the current value over and over and over and over
> again.
>
> > synchronized methods of java do the same thing , can i do
> > similiar thing in oracle? does global context provide this type of
> > funcionality?
>
> We need to know why you think you 'need' such a crutch. You'll need
> to explain in far more detail.
>
> > kind regards,
> > hope
>
> David Fitzjarrell
Hope, I agree with David.
One way to reuse sequence values besides the currval function call is if by reuse you mean reuse an older value that was used in the past is to set the sequence to cycle so that once the maximum sequence value has been issued the sequence issued value loops around and starts the cycle over. You just have to make sure that the rows with the reused value have been deleted. That or you use the value in an update statement to replace the old data such as in the case where the table is used as a circular log.
HTH -- Mark D Powell -- Received on Fri Sep 05 2008 - 08:35:04 CDT