Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

global context instead of for update or another idea ?

0 views
Skip to first unread message

hopehope_123

unread,
Sep 5, 2008, 3:43:01 AM9/5/08
to
Hi ,

is it possible to use global variables in oracle? and is there any
way to control concurrency on this memory variable?

i can use a table, and read this by using for update. Under heavy
loads, this will create contention.

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 , and this
creates contention also. and i need to use reuse values so
sequence does not allow to use older values.

synchronized methods of java do the same thing , can i do
similiar thing in oracle? does global context provide this type of
funcionality?

kind regards,
hope


ora...@msn.com

unread,
Sep 5, 2008, 8:47:45 AM9/5/08
to
Comments embedded.

On Sep 5, 2:43 am, hopehope_123 <hopehope_...@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

Mark D Powell

unread,
Sep 5, 2008, 9:35:04 AM9/5/08
to

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 --


DA Morgan

unread,
Sep 5, 2008, 10:38:45 AM9/5/08
to

In the sense that you seem to be asking the question global variables
do not exist though one could kludge one together using AQ. Something
I would definitely describe as a really bad idea.

What bothers me about your post is that you seem to think multiple
sessions going for sequence.NEXTVAL creates contention. It doesn't
unless you are doing something really terrible. Describe what it is you
are doing as well as your version number (3 decimal places).
--
Daniel A. Morgan
Oracle Ace Director & Instructor
University of Washington
damo...@x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org

hopehope_123

unread,
Sep 5, 2008, 5:57:00 PM9/5/08
to
Hi,

thank you very much for your answers. What i understand from your
posts is that i need to rethink my issue .

thx again.

(may be , i can ask one more, what happens if i write a java stored
procedure which uses global variables inside (as static ) ... but
first i need to know more about this...... , better forget .)

hope

DA Morgan

unread,
Sep 5, 2008, 10:54:37 PM9/5/08
to

You may well have an issue but I think your root cause analysis
should be re-evaluated.

0 new messages