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: How to get the last insert id

Re: How to get the last insert id

From: <fitzjarrell_at_cox.net>
Date: Sat, 08 Sep 2007 13:45:11 -0700
Message-ID: <1189284311.438930.200340@k79g2000hse.googlegroups.com>


On Sep 8, 4:20 am, "Norbert Pürringer" <thalio..._at_graffiti.net> wrote:
> 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

I answered that before you posted this reply, so I suggest you look at my response again and concentrate on using the RETURNING clause of the INSERT statement, the use of which was provided in my example.

David Fitzjarrell Received on Sat Sep 08 2007 - 15:45:11 CDT

Original text of this message

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