Re: How to retrieve an auto-increment ID of a row

From: briansan <brian.sanford_at_home.com>
Date: 4 Sep 2001 14:52:01 GMT
Message-ID: <999614838.800069_at_proxy.storm.co.za>


Hi,

I have used the following in Oracle Stored Procedures. I am not sure how it will work with the language you are developing in. I assume it should work.

INSERT INTO tablename
VALUES (....)
RETURNING id INTO [id_variable]

Sorry for the syntax but that should get you far enough to look at the Oracle documentation.

Brian

David Lee wrote:

> After I inserted a row of data, how do I retrieve the auto-increment ID of
> this row ? Because there might be another SQL script also inserting into
> this table at the same time, it is not guaranteed that I will get the
> correct ID by selecting right after inserting. Is there a function for
> this? Thousands of appreciation!!!

> Please tell me where I should post this question if I post the wrong
> newsgroup, thanks!!

Posted via www.orafocus.com - Focusing on the World of Oracle Received on Tue Sep 04 2001 - 16:52:01 CEST

Original text of this message