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 select the last item's ID

Re: How to select the last item's ID

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Tue, 04 Sep 2001 22:04:21 +0100
Message-ID: <3B9541D5.693A@yahoo.com>


David Lee wrote:
>
> I am really sorry about this, but is it possible for you to show me an
> example? Thanks!
>
> "Davide Bianchi" <davidebianchi_at_davidebianchi.net> ¼¶¼g©ó¶l¥ó
> news:9n2jo1$4scm0$1_at_ID-18487.news.dfncis.de...
> > "David Lee" <pritino2020_at_yahoo.com.tw> wrote in message
> > news:9n2i6h$2n5t1$1_at_news.shem.etwebs.com...
> > > After I inserted a row of data, how do I retrieve the
> > > auto-increment ID of this row ?
> >
> > If you are using a SEQUENCE, you just ask for the
> > NEXT value of the sequence and then use that as ID for
> > your table (so, there is no automatic insertion).
> > Otherwise, you can use a Stored Procedure that insert
> > the data and return the generated ID.
> >
> > Davide
> >
> >
> >

insert into my_table values ( x,y,z)
returning the_seq_column
into my_variable;

hth
connor

-- 
==============================
Connor McDonald

http://www.oracledba.co.uk

"Some days you're the pigeon, some days you're the statue..."
Received on Tue Sep 04 2001 - 16:04:21 CDT

Original text of this message

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