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: Einar Magnus Råberg <einarmr_at_tihlde.org>
Date: Thu, 15 Mar 2001 14:49:54 +0100
Message-ID: <3AB0C882.64D3ECF2@tihlde.org>

Mark Wagoner wrote:
> "Einar Magnus Råberg" <einarmr_at_tihlde.org> wrote in message
> news:3AB0C680.14D00D6D_at_tihlde.org...
> >
> > 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?
>
> 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.

OK, I'm using Oracle 7.

Could you give me som examples?

In advance, thank you.

-Einar Received on Thu Mar 15 2001 - 07:49:54 CST

Original text of this message

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