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: Frank van Bortel <frank.van.bortel_at_gmail.com>
Date: Sun, 09 Sep 2007 12:43:46 +0200
Message-ID: <fc0nip$80l$3@news4.zwoll1.ov.home.nl>


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Norbert Pürringer 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
>
>

Lookup INSERT INTO ... RETURNING
http://tahiti.oracle.com.

Without doubt, Daniel has some examples in his library, too, but only 11.0, of course :)
But you'll get the idea
- --
Regards,
Frank van Bortel

Top-posting is one way to shut me up...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)

iD8DBQFG485iLw8L4IAs830RAiHrAJ9HsFX2BKrztOToJqCF9qgCs6CrTQCfZU/w KQroIVWGdeNpbyTesOTGctE=
=NwZm
-----END PGP SIGNATURE----- Received on Sun Sep 09 2007 - 05:43:46 CDT

Original text of this message

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