Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to get the last insert id
Hello once more!
If I use a sequence, it's of course no problem to get the ID of the last inserted dataset. But imagine, that the primary key consists of GUID values and the default value of the primary key column is New_Guid. So a new dataset will produce a new GUID value which I want to use in the next statement. But how?
You must consider, that I work with the database via ADO.NET. After updating the new dataset, reading out the value of the GUID primary key results to DBNull instead of giving me the new GUID value. So I think the only way is to execute another SQL statement retrieving me the new value. Other database systems provide SQL functions like Scope_Idendity or LastInsertID.
Kind regards,
Norbert
Received on Sat Sep 08 2007 - 04:20:33 CDT