Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: CURRVAL in multi-user environments

Re: CURRVAL in multi-user environments

From: Matthew Nicoll <menicoll_at_mars.ark.com>
Date: Mon, 10 Jun 2002 06:03:01 GMT
Message-ID: <3d0440bd.1642343@news.ark.com>


Thank you John!

I had not thought of opening two sessions with the same username to test it.

On Tue, 4 Jun 2002 23:16:36 +0000 (UTC), "John Claxton" <johnclaxton_at_advi.net> wrote:

>Matthew:
>
> Here's what I did:
>Session 1:
> $ sqlplus scott/tiger
> SQL> create sequent test_seq;
> SQL> select test_seq.nextval from dual;
> NEXTVAL
> -------
> 1
>
>Session 2:
> $ sqlplus scott/tiger
> SQL> select test_seq.nextval from dual;
> NEXTVAL
> -------
> 2
>
>Session 1:
> SQL> select test_seq.currval from dual;
> CURRVAL
> -------
> 1
>
>Yep, Oracle is smart [ not unlike some answers you'll get from time to
>time :-) ]
>
>jc
>johnclaxton_at_networkessentials.com
>Home of: Get Certified!
>Over 1,000 Free Sample Questions
>http://www.networkessentials.com/certified/ocp
>"Matthew Nicoll" <menicoll_at_mars.ark.com> wrote in message
>news:3cead5b7.29654761_at_news.ark.com
>
>> The Oracle documentation I have seen suggests I can define a sequence,
>> then use sequence_name.NEXTVAL for an ID for a parent row,
>> then use sequence_name.CURVAL in subsequent writes to child rows.
>>
>> In a multi-user environment, if the order of events is:
>> User 1 - NextVal gets 100
>> User 2 - NextVal gets 101
>> User 1 - CurrVal gets 100 or 101?
>>
>> I.e. is Oracle smart enough to keep a different CURRVAL for
>> each user?
>
>
>
>
>--
>Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
Received on Mon Jun 10 2002 - 01:03:01 CDT

Original text of this message

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