Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Getting the identity of the row just inserted

Re: Getting the identity of the row just inserted

From: Mark Wagoner <mwagoner_at_iac.net>
Date: Thu, 15 Mar 2001 08:45:11 -0500
Message-ID: <98qh18$1njs$1@genma.iac.net>

In 8i you can use the RETURNING clause to get back the sequence value just inserted.

Pre-8i, you will have to select the sequence value into a variable, then do your inserts with that.

"Einar Magnus Råberg" <einarmr_at_tihlde.org> wrote in message news:3AB0C680.14D00D6D_at_tihlde.org...
> Hi!
>
>
> If I insert a row into a table
> INSERT INTO foobar VALUES(foocounter.nextval, 'Hi', 'You');
>
> How do I get the primary key of the row I just inserted?
>
> This primary key is needed to insert a row in another table.
>
>
> -Einar
Received on Thu Mar 15 2001 - 07:45:11 CST

Original text of this message

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