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: John Claxton <johnclaxton_at_advi.net>
Date: Tue, 4 Jun 2002 23:16:36 +0000 (UTC)
Message-ID: <2bbe6b1c245999c7880e33ab4cc817d9.96068@mygate.mailgate.org>


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 Tue Jun 04 2002 - 18:16:36 CDT

Original text of this message

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