OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: MAXDB CURRVAL Question

From: Daniel Dittmar (daniel.dittmarsap.com)
Date: Fri Mar 12 2004 - 17:55:03 CST


MaxDB - Mailing List wrote:
> I have found that the CURRVAL function will return the last inserted id. Is
> that guaranteed? Is it based on the session. If another session inserts
> before you read CURRVAL, will you get that CURRVAL instead?
>
> So, I guess what I am trying to say is that if I run
>
> /*code copied from another listing*/
> CREATE TABLE TEST (k serial, s integer)
> INSERT INTO TEST SET s = 1
> SELECT TEST.CURRVAL FROM DUAL
>
> is it guaranteed that it will return the id of the row that this chunk
> executed?

CURRVAL will return the last value *generated in this session*.

Daniel Dittmar

--
Daniel Dittmar
SAP Labs Berlin
daniel.dittmarsap.com

--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb